linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Rientjes <rientjes@google.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	linux-mm@kvack.org
Subject: [patch -mm 3/3] mm, oom: do not emit oom killer warning if chosen thread is already exiting
Date: Fri, 13 Jan 2012 16:39:16 -0800 (PST)	[thread overview]
Message-ID: <alpine.DEB.2.00.1201131638500.9310@chino.kir.corp.google.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1201131638020.9310@chino.kir.corp.google.com>

If a thread is chosen for oom kill and is already PF_EXITING, then the
oom killer simply sets TIF_MEMDIE and returns.  This allows the thread to
have access to memory reserves so that it may quickly exit.  This logic
is preceeded with a comment saying there's no need to alarm the sysadmin.
This patch adds truth to that statement.

There's no need to emit any warning about the oom condition if the thread
is already exiting since it will not be killed.  In this condition, just
silently return the oom killer since its only giving access to memory
reserves and is otherwise a no-op.

Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: David Rientjes <rientjes@google.com>
---
 mm/oom_kill.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/mm/oom_kill.c b/mm/oom_kill.c
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -445,9 +445,6 @@ static void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
 	struct mm_struct *mm;
 	unsigned int victim_points = 0;
 
-	if (printk_ratelimit())
-		dump_header(p, gfp_mask, order, memcg, nodemask);
-
 	/*
 	 * If the task is already exiting, don't alarm the sysadmin or kill
 	 * its children or threads, just set TIF_MEMDIE so it can die quickly
@@ -457,6 +454,9 @@ static void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
 		return;
 	}
 
+	if (printk_ratelimit())
+		dump_header(p, gfp_mask, order, memcg, nodemask);
+
 	task_lock(p);
 	pr_err("%s: Kill process %d (%s) score %d or sacrifice child\n",
 		message, task_pid_nr(p), p->comm, points);

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      parent reply	other threads:[~2012-01-14  0:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-12  3:24 [patch 1/3] mm, oom: avoid looping when chosen thread detaches its mm David Rientjes
2012-01-12  3:24 ` [patch 2/3] mm, oom: fold oom_kill_task into oom_kill_process David Rientjes
2012-01-12  3:48   ` KOSAKI Motohiro
2012-01-12  4:48   ` KAMEZAWA Hiroyuki
2012-01-12  3:24 ` [patch 3/3] mm, oom: do not emit oom killer warning if chosen thread is already exiting David Rientjes
2012-01-12  3:48   ` KOSAKI Motohiro
2012-01-12  4:49   ` KAMEZAWA Hiroyuki
2012-01-12 14:44   ` Michal Hocko
2012-01-12  4:47 ` [patch 1/3] mm, oom: avoid looping when chosen thread detaches its mm KAMEZAWA Hiroyuki
2012-01-12 14:26 ` Michal Hocko
2012-01-14  0:39 ` [patch -mm " David Rientjes
2012-01-14  0:39   ` [patch -mm 2/3] mm, oom: fold oom_kill_task into oom_kill_process David Rientjes
2012-01-14  0:39   ` 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.1201131638500.9310@chino.kir.corp.google.com \
    --to=rientjes@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-mm@kvack.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