aboutsummaryrefslogtreecommitdiffstats
path: root/mm/oom_kill.c
diff options
context:
space:
mode:
authorDavid Rientjes <rientjes@google.com>2009-06-16 18:33:16 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-16 22:47:45 -0400
commit81236810226f71bd9ff77321c8e8276dae7efc61 (patch)
tree8194006c780be40bfac49a2c557ab037186a57e9 /mm/oom_kill.c
parent9198e96c06744517e3b18fce8be6db61e96a3227 (diff)
oom: only oom kill exiting tasks with attached memory
When a task is chosen for oom kill and is found to be PF_EXITING, __oom_kill_task() is called to elevate the task's timeslice and give it access to memory reserves so that it may quickly exit. This privilege is unnecessary, however, if the task has already detached its mm. Although its possible for the mm to become detached later since task_lock() is not held, __oom_kill_task() will simply be a no-op in such circumstances. Subsequently, it is no longer necessary to warn about killing mm-less tasks since it is a no-op. Signed-off-by: David Rientjes <rientjes@google.com> Acked-by: Rik van Riel <riel@redhat.com> Cc: Balbir Singh <balbir@linux.vnet.ibm.com> Cc: Minchan Kim <minchan.kim@gmail.com> Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> 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.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index cdcf89cb9ff2..175a67a78a99 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -325,11 +325,8 @@ static void __oom_kill_task(struct task_struct *p, int verbose)
325 return; 325 return;
326 } 326 }
327 327
328 if (!p->mm) { 328 if (!p->mm)
329 WARN_ON(1);
330 printk(KERN_WARNING "tried to kill an mm-less task!\n");
331 return; 329 return;
332 }
333 330
334 if (verbose) 331 if (verbose)
335 printk(KERN_ERR "Killed process %d (%s)\n", 332 printk(KERN_ERR "Killed process %d (%s)\n",
@@ -397,8 +394,9 @@ static int oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
397 /* 394 /*
398 * If the task is already exiting, don't alarm the sysadmin or kill 395 * If the task is already exiting, don't alarm the sysadmin or kill
399 * its children or threads, just set TIF_MEMDIE so it can die quickly 396 * its children or threads, just set TIF_MEMDIE so it can die quickly
397 * if its mm is still attached.
400 */ 398 */
401 if (p->flags & PF_EXITING) { 399 if (p->mm && (p->flags & PF_EXITING)) {
402 __oom_kill_task(p, 0); 400 __oom_kill_task(p, 0);
403 return 0; 401 return 0;
404 } 402 }