From: Michal Hocko <mhocko@kernel.org>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: linux-mm@kvack.org, rientjes@google.com, oleg@redhat.com,
vdavydov@parallels.com, akpm@linux-foundation.org
Subject: Re: [PATCH 0/5] Handle oom bypass more gracefully
Date: Mon, 30 May 2016 13:35:04 +0200 [thread overview]
Message-ID: <20160530113504.GT22928@dhcp22.suse.cz> (raw)
In-Reply-To: <201605302010.AGF00027.tQHSFOFJMOVFOL@I-love.SAKURA.ne.jp>
On Mon 30-05-16 20:10:46, Tetsuo Handa wrote:
> Michal Hocko wrote:
> > > You are trying to make the OOM killer as per mm_struct operation. But
> > > I think we need to tolerate the OOM killer as per signal_struct operation.
> >
> > Signal struct based approach is full of weird behavior which just leads
> > to corner cases. I think going mm struct way is the only sensible
> > approach.
>
> I don't think so. What are corner cases the OOM reaper cannot handle with
> signal_struct based approach?
E.g. all the mm shared outside of the thread group with weird
inconsistencies crap.
> The OOM-killer decides based on "struct mm_struct" but it is a weakness of
> the OOM-killer that it cares only "struct mm_struct". It is possible that
> waiting for termination of only one thread releases a lot of memory (e.g.
> by closing pipe's file descriptor) and the OOM-killer needs to send SIGKILL
> to nobody.
How can a thread release pipe's memory when other threads are sharing
the same fd?
[...]
> Given that said, if everybody can agree with making the OOM-killer per
> "struct mm_struct" operation, I think reimplementing oom_disable_count which
> was removed by commit c9f01245b6a7d77d ("oom: remove oom_disable_count") (i.e.
> do not select an OOM victim unless all thread groups using that mm_struct is
> killable) seems to be better than ignoring what userspace told to do (i.e.
> select an OOM victim even if some thread groups using that mm_struct is not
> killable). Userspace knows the risk of setting OOM_SCORE_ADJ_MIN; it is a
> strong request like __GFP_NOFAIL allocation. We have global oom_lock which
> avoids race condition. Since writing to /proc/pid/oom_score_adj is not frequent,
> we can afford mutex_lock_killable(&oom_lock). We can interpret use_mm() request
> as setting OOM_SCORE_ADJ_MIN.
I am not really sure oom_lock is even needed. It is highly unlikely we
would race with an ongoing OOM killer. And even then the lock doesn't
bring much better semantic.
Regarding oom_disable_count, I think the current approach of
http://lkml.kernel.org/r/1464266415-15558-4-git-send-email-mhocko@kernel.org
has one large advantage. The userspace can simply check the current
situation while any internal flag/counter/whatever hides that
implementation fact and so the userspace has no means to deal with it.
Sure, it can be argued that changing oom_score_adj behind process back
is nasty but we already do that for threads and nobody seems to
complain. Shared mm between processes is just a different model of
threading from the MM point of view. Or is this thinking wrong in
principle?
--
Michal Hocko
SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2016-05-30 11:35 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-26 12:40 Michal Hocko
2016-05-26 12:40 ` [PATCH 1/6] mm, oom: do not loop over all tasks if there are no external tasks sharing mm Michal Hocko
2016-05-26 14:30 ` Tetsuo Handa
2016-05-26 14:59 ` Michal Hocko
2016-05-26 15:25 ` [PATCH 1/6] mm, oom: do not loop over all tasks if there are noexternal " Tetsuo Handa
2016-05-26 15:35 ` Michal Hocko
2016-05-26 16:14 ` [PATCH 1/6] mm, oom: do not loop over all tasks if there are no external " Tetsuo Handa
2016-05-27 6:45 ` Michal Hocko
2016-05-27 7:15 ` Michal Hocko
2016-05-27 8:03 ` Michal Hocko
2016-05-27 10:15 ` Tetsuo Handa
2016-05-26 12:40 ` [PATCH 2/6] proc, oom_adj: extract oom_score_adj setting into a helper Michal Hocko
2016-05-26 12:40 ` [PATCH 3/6] mm, oom_adj: make sure processes sharing mm have same view of oom_score_adj Michal Hocko
2016-05-27 11:18 ` Michal Hocko
2016-05-27 16:18 ` Vladimir Davydov
2016-05-30 7:07 ` Michal Hocko
2016-05-30 8:47 ` Vladimir Davydov
2016-05-30 9:39 ` Michal Hocko
2016-05-30 10:26 ` Vladimir Davydov
2016-05-30 11:11 ` Michal Hocko
2016-05-30 12:19 ` Vladimir Davydov
2016-05-30 12:28 ` Michal Hocko
2016-05-26 12:40 ` [PATCH 4/6] mm, oom: skip over vforked tasks Michal Hocko
2016-05-27 16:48 ` Vladimir Davydov
2016-05-30 7:13 ` Michal Hocko
2016-05-30 9:52 ` Michal Hocko
2016-05-30 10:40 ` Vladimir Davydov
2016-05-30 10:53 ` Michal Hocko
2016-05-30 12:03 ` Michal Hocko
2016-05-26 12:40 ` [PATCH 5/6] mm, oom: kill all tasks sharing the mm Michal Hocko
2016-05-26 12:40 ` [PATCH 6/6] mm, oom: fortify task_will_free_mem Michal Hocko
[not found] ` <201605262311.FFF64092.FFQVtOLOOMJSFH@I-love.SAKURA.ne.jp>
[not found] ` <20160526142317.GC23675@dhcp22.suse.cz>
2016-05-26 14:41 ` Tetsuo Handa
2016-05-26 14:56 ` Michal Hocko
2016-05-27 11:07 ` Michal Hocko
2016-05-27 16:00 ` [PATCH 0/5] Handle oom bypass more gracefully Michal Hocko
2016-05-28 14:04 ` Tetsuo Handa
2016-05-30 7:21 ` Michal Hocko
2016-05-30 11:10 ` Tetsuo Handa
2016-05-30 11:35 ` Michal Hocko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160530113504.GT22928@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=oleg@redhat.com \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=rientjes@google.com \
--cc=vdavydov@parallels.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox