From: David Rientjes <rientjes@google.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Rik van Riel <riel@redhat.com>, Nick Piggin <npiggin@suse.de>,
Balbir Singh <balbir@linux.vnet.ibm.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
linux-mm@kvack.org
Subject: [patch 11/11 -mm v4] oom: avoid race for oom killed tasks detaching mm prior to exit
Date: Wed, 17 Mar 2010 01:55:56 -0700 (PDT) [thread overview]
Message-ID: <alpine.DEB.2.00.1003170154590.31796@chino.kir.corp.google.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1003170151540.31796@chino.kir.corp.google.com>
Tasks detach its ->mm prior to exiting so it's possible that in progress
oom kills or already exiting tasks may be missed during the oom killer's
tasklist scan. When an eligible task is found with either TIF_MEMDIE or
PF_EXITING set, the oom killer is supposed to be a no-op to avoid
needlessly killing additional tasks. This closes the race between a task
detaching its ->mm and being removed from the tasklist.
Out of memory conditions as the result of memory controllers will
automatically filter tasks that have detached their ->mm (since
task_in_mem_cgroup() will return 0). This is acceptable, however, since
memcg constrained ooms aren't the result of a lack of memory resources
but rather a limit imposed by userspace that requires a task be killed
regardless.
Signed-off-by: David Rientjes <rientjes@google.com>
---
mm/oom_kill.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -290,12 +290,6 @@ static struct task_struct *select_bad_process(unsigned int *ppoints,
for_each_process(p) {
unsigned int points;
- /*
- * skip kernel threads and tasks which have already released
- * their mm.
- */
- if (!p->mm)
- continue;
/* skip the init task */
if (is_global_init(p))
continue;
@@ -336,6 +330,12 @@ static struct task_struct *select_bad_process(unsigned int *ppoints,
*ppoints = 1000;
}
+ /*
+ * skip kernel threads and tasks which have already released
+ * their mm.
+ */
+ if (!p->mm)
+ continue;
if (p->signal->oom_score_adj == OOM_SCORE_ADJ_MIN)
continue;
--
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:[~2010-03-17 8:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-17 8:55 [patch 00/11 -mm v4] oom killer rewrite David Rientjes
2010-03-17 8:55 ` [patch 01/11 -mm v4] oom: filter tasks not sharing the same cpuset David Rientjes
2010-03-17 8:55 ` [patch 02/11 -mm v4] oom: sacrifice child with highest badness score for parent David Rientjes
2010-03-17 8:55 ` [patch 03/11 -mm v4] oom: select task from tasklist for mempolicy ooms David Rientjes
2010-03-17 8:55 ` [patch 04/11 -mm v4] oom: remove special handling for pagefault ooms David Rientjes
2010-03-17 8:55 ` [patch 05/11 -mm v4] oom: badness heuristic rewrite David Rientjes
2010-03-17 8:55 ` [patch 06/11 -mm v4] oom: deprecate oom_adj tunable David Rientjes
2010-03-17 8:55 ` [patch 07/11 -mm v4] oom: replace sysctls with quick mode David Rientjes
2010-03-17 8:55 ` [patch 08/11 -mm v4] oom: avoid oom killer for lowmem allocations David Rientjes
2010-03-17 8:55 ` [patch 09/11 -mm v4] oom: remove unnecessary code and cleanup David Rientjes
2010-03-17 8:55 ` [patch 10/11 -mm v4] oom: default to killing current for pagefault ooms David Rientjes
2010-03-17 8:55 ` David Rientjes [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=alpine.DEB.2.00.1003170154590.31796@chino.kir.corp.google.com \
--to=rientjes@google.com \
--cc=akpm@linux-foundation.org \
--cc=balbir@linux.vnet.ibm.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-mm@kvack.org \
--cc=npiggin@suse.de \
--cc=riel@redhat.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