diff options
author | David Rientjes <rientjes@google.com> | 2012-03-21 19:33:47 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-21 20:54:55 -0400 |
commit | 8447d950e7445cae71ad66d0e33784f8388aaf9d (patch) | |
tree | b7f7cfba3d2264b87ca168131e0a65d89faa51a8 /mm/oom_kill.c | |
parent | 647f2bdf4a00dbcaa8964286501d68e7d2e6da93 (diff) |
mm, oom: do not emit oom killer warning if chosen thread is already exiting
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>
Acked-by: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/oom_kill.c')
-rw-r--r-- | mm/oom_kill.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index d402b2c1040e..856106036ba2 100644 --- 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, | |||
445 | struct mm_struct *mm; | 445 | struct mm_struct *mm; |
446 | unsigned int victim_points = 0; | 446 | unsigned int victim_points = 0; |
447 | 447 | ||
448 | if (printk_ratelimit()) | ||
449 | dump_header(p, gfp_mask, order, memcg, nodemask); | ||
450 | |||
451 | /* | 448 | /* |
452 | * If the task is already exiting, don't alarm the sysadmin or kill | 449 | * If the task is already exiting, don't alarm the sysadmin or kill |
453 | * its children or threads, just set TIF_MEMDIE so it can die quickly | 450 | * 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, | |||
457 | return; | 454 | return; |
458 | } | 455 | } |
459 | 456 | ||
457 | if (printk_ratelimit()) | ||
458 | dump_header(p, gfp_mask, order, memcg, nodemask); | ||
459 | |||
460 | task_lock(p); | 460 | task_lock(p); |
461 | pr_err("%s: Kill process %d (%s) score %d or sacrifice child\n", | 461 | pr_err("%s: Kill process %d (%s) score %d or sacrifice child\n", |
462 | message, task_pid_nr(p), p->comm, points); | 462 | message, task_pid_nr(p), p->comm, points); |