From: David Rientjes <rientjes@google.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
akpm@linux-foundation.org, mgorman@suse.de, oleg@redhat.com,
torvalds@linux-foundation.org, hughd@google.com,
andrea@kernel.org, riel@redhat.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] mm,oom: exclude oom_task_origin processes if they are OOM-unkillable.
Date: Tue, 23 Feb 2016 14:33:01 -0800 (PST) [thread overview]
Message-ID: <alpine.DEB.2.10.1602231420590.744@chino.kir.corp.google.com> (raw)
In-Reply-To: <20160223123457.GC14178@dhcp22.suse.cz>
On Tue, 23 Feb 2016, Michal Hocko wrote:
> > oom_badness() ranges from 0 (don't kill) to 1000 (please kill). It
> > factors in the setting of /proc/self/oom_score_adj to change that value.
> > That is where OOM_SCORE_ADJ_MIN is enforced.
>
> The question is whether the current placement of OOM_SCORE_ADJ_MIN
> is appropriate. Wouldn't it make more sense to check it in oom_unkillable_task
> instead?
oom_unkillable_task() deals with the type of task it is (init or kthread)
or being ineligible due to the memcg and cpuset placement. We want to
exclude them from consideration and also suppress them from the task dump
in the kernel log. We don't want to suppress oom disabled processes, we
really want to know their rss, for example. It could be renamed
is_ineligible_task().
> Sure, checking oom_score_adj under task_lock inside oom_badness will
> prevent from races but the question I raised previously was whether we
> actually care about those races? When would it matter? Is it really
> likely that the update happen during the oom killing? And if yes what
> prevents from the update happening _after_ the check?
>
It's not necessarily to take task_lock(), but find_lock_task_mm() is the
means we have to iterate threads to find any with memory attached. We
need that logic in oom_badness() to avoid racing with threads that have
entered exit_mm(). It's possible for a thread to have a non-NULL ->mm in
oom_scan_process_thread(), the thread enters exit_mm() without kill, and
oom_badness() can still find it to be eligible because other threads have
not exited. We still want to issue a kill to this process and task_lock()
protects the setting of task->mm to NULL: don't consider it to be a race
in setting oom_score_adj, consider it to be a race in unmapping (but not
freeing) memory in th exit path.
--
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>
next prev parent reply other threads:[~2016-02-23 22:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-17 14:31 Tetsuo Handa
2016-02-17 14:48 ` Michal Hocko
2016-02-17 22:31 ` David Rientjes
2016-02-18 8:09 ` Michal Hocko
2016-02-18 10:30 ` Tetsuo Handa
2016-02-18 12:08 ` Michal Hocko
2016-02-18 12:13 ` Michal Hocko
2016-02-19 15:07 ` Tetsuo Handa
2016-02-19 15:13 ` Michal Hocko
2016-02-23 1:06 ` David Rientjes
2016-02-23 12:34 ` Michal Hocko
2016-02-23 22:33 ` David Rientjes [this message]
2016-02-24 10:05 ` Michal Hocko
2016-02-24 21:36 ` David Rientjes
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=alpine.DEB.2.10.1602231420590.744@chino.kir.corp.google.com \
--to=rientjes@google.com \
--cc=akpm@linux-foundation.org \
--cc=andrea@kernel.org \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mhocko@kernel.org \
--cc=oleg@redhat.com \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=riel@redhat.com \
--cc=torvalds@linux-foundation.org \
/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