linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Rientjes <rientjes@google.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Rik van Riel <riel@redhat.com>, Nick Piggin <npiggin@suse.de>,
	Balbir Singh <balbir@linux.vnet.ibm.com>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	linux-mm@kvack.org
Subject: Re: [patch 00/10 -mm v3] oom killer rewrite
Date: Tue, 16 Mar 2010 18:00:35 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.2.00.1003161747240.7128@chino.kir.corp.google.com> (raw)
In-Reply-To: <20100312163415.ff6fb5c5.kamezawa.hiroyu@jp.fujitsu.com>

On Fri, 12 Mar 2010, KAMEZAWA Hiroyuki wrote:

> BTW, it seems there are still chances for serial-oom-killer.
> 
> Assume I run memory eater (called malloc) on a host.
> ==
> Mar 13 13:05:56 localhost kernel: malloc invoked oom-killer: gfp_mask=0x280da, order=0, oom_adj=0, oom_score_adj=0
> Mar 13 13:05:56 localhost kernel: malloc cpuset=/ mems_allowed=0
> Mar 13 13:05:56 localhost kernel: Pid: 2525, comm: malloc Not tainted 2.6.34-rc1-mm1+ #3
> Mar 13 13:05:56 localhost kernel: Call Trace:
> Mar 13 13:05:56 localhost kernel: [<ffffffff8108aebf>] ? cpuset_print_task_mems_allowed+0x91/0x9c
> Mar 13 13:05:56 localhost kernel: [<ffffffff810c90c1>] dump_header+0x74/0x1af
> <snip>
> Mar 13 13:05:56 localhost kernel: [ 2525]   500  2525   434340   433346   0       0             0 malloc
> Mar 13 13:05:56 localhost kernel: Out of memory: Kill process 2525 (malloc) with score 967 or sacrifice child
> Mar 13 13:05:56 localhost kernel: Killed process 2525 (malloc) total-vm:1737360kB, anon-rss:1733364kB, file-rss:20kB
> Mar 13 13:05:56 localhost kernel: rsyslogd invoked oom-killer: gfp_mask=0x201da, order=0, oom_adj=0, oom_score_adj=0
> Mar 13 13:05:56 localhost kernel: rsyslogd cpuset=/ mems_allowed=0
> Mar 13 13:05:56 localhost kernel: Pid: 696, comm: rsyslogd Not tainted 2.6.34-rc1-mm1+ #3
> Mar 13 13:05:56 localhost kernel: Call Trace:
> Mar 13 13:05:56 localhost kernel: [<ffffffff8108aebf>] ? cpuset_print_task_mems_allowed+0x91/0x9c
> Mar 13 13:05:56 localhost kernel: [<ffffffff810c90c1>] dump_header+0x74/0x1af
> Mar 13 13:05:56 localhost kernel: [<ffffffff81211a8e>] ? ___ratelimit+0xe6/0x104
> Mar 13 13:05:56 localhost kernel: [<ffffffff810c942a>] oom_kill_process+0x49/0x1ed
> <snip>
> Mar 13 13:05:56 localhost kernel: 480 total pagecache pages
> Mar 13 13:05:56 localhost kernel: 0 pages in swap cache
> Mar 13 13:05:56 localhost kernel: Swap cache stats: add 0, delete 0, find 0/0
> Mar 13 13:05:56 localhost kernel: Free swap  = 0kB
> Mar 13 13:05:56 localhost kernel: Total swap = 0kB
> Mar 13 13:05:56 localhost kernel: 2097151 pages RAM
> Mar 13 13:05:56 localhost kernel: 48776 pages reserved
> Mar 13 13:05:56 localhost kernel: 1356 pages shared
> Mar 13 13:05:56 localhost kernel: 458132 pages non-shared
> <snip>
> Mar 13 13:05:56 localhost kernel: [ 2506]     0  2506     3120       55   0       0             0 anacron
> Mar 13 13:05:56 localhost kernel: Out of memory: Kill process 1267 (gdm-simple-gree) with score 2 or sacrifice child
> Mar 13 13:05:56 localhost kernel: Killed process 1267 (gdm-simple-gree) total-vm:359156kB, anon-rss:4012kB, file-rss:472kB
> ==
> 
> Then, at first, malloc, a bad program is killed. But, another oom-kill happens immediately and 
> gdm-simple-gree is killed.
> 
> I think there is a task as !p->mm but TIF_MEMDIE task in tasklist.
> 

Perhaps, but we should probably handle exit racing conditions with 
PF_EXITING instead of TIF_MEMDIE.  We also need to filter these tasks 
according to memcg and cpusets since oom killed tasks in other cgroups 
shouldn't make the oom killer a no-op for current.

I'll add this:
---
 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>

  reply	other threads:[~2010-03-17  1:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-10 10:41 David Rientjes
2010-03-10 10:41 ` [patch 01/10 -mm v3] oom: filter tasks not sharing the same cpuset David Rientjes
2010-03-10 10:41 ` [patch 02/10 -mm v3] oom: sacrifice child with highest badness score for parent David Rientjes
2010-03-10 10:41 ` [patch 03/10 -mm v3] oom: select task from tasklist for mempolicy ooms David Rientjes
2010-03-10 10:41 ` [patch 04/10 -mm v3] oom: remove special handling for pagefault ooms David Rientjes
2010-03-10 10:41 ` [patch 05/10 -mm v3] oom: badness heuristic rewrite David Rientjes
2010-03-12  6:20   ` KAMEZAWA Hiroyuki
2010-03-17  1:26     ` David Rientjes
2010-03-17  1:44       ` KAMEZAWA Hiroyuki
2010-03-17  3:30         ` David Rientjes
2010-03-10 10:41 ` [patch 06/10 -mm v3] oom: deprecate oom_adj tunable David Rientjes
2010-03-10 10:41 ` [patch 07/10 -mm v3] oom: replace sysctls with quick mode David Rientjes
2010-03-10 10:41 ` [patch 08/10 -mm v3] oom: avoid oom killer for lowmem allocations David Rientjes
2010-03-10 10:41 ` [patch 09/10 -mm v3] oom: remove unnecessary code and cleanup David Rientjes
2010-03-10 10:41 ` [patch 10/10 -mm v3] oom: default to killing current for pagefault ooms David Rientjes
2010-03-12  7:34 ` [patch 00/10 -mm v3] oom killer rewrite KAMEZAWA Hiroyuki
2010-03-17  1:00   ` David Rientjes [this message]
2010-03-12  7:46 ` KAMEZAWA Hiroyuki
2010-03-17  1:21   ` 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.00.1003161747240.7128@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