Commit 01017a22 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds

[PATCH] oom_kill_task(): cleanup ->mm checks

- It is not possible to have task->mm == &init_mm.

- task_lock() buys nothing for 'if (!p->mm)' check.
Signed-off-by: default avatarOleg Nesterov <oleg@tv-sign.ru>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 972c4ea5
...@@ -260,14 +260,11 @@ static void __oom_kill_task(struct task_struct *p, const char *message) ...@@ -260,14 +260,11 @@ static void __oom_kill_task(struct task_struct *p, const char *message)
return; return;
} }
task_lock(p); if (!p->mm) {
if (!p->mm || p->mm == &init_mm) {
WARN_ON(1); WARN_ON(1);
printk(KERN_WARNING "tried to kill an mm-less task!\n"); printk(KERN_WARNING "tried to kill an mm-less task!\n");
task_unlock(p);
return; return;
} }
task_unlock(p);
if (message) { if (message) {
printk(KERN_ERR "%s: Killed process %d (%s).\n", printk(KERN_ERR "%s: Killed process %d (%s).\n",
...@@ -301,7 +298,7 @@ static int oom_kill_task(struct task_struct *p, const char *message) ...@@ -301,7 +298,7 @@ static int oom_kill_task(struct task_struct *p, const char *message)
* However, this is of no concern to us. * However, this is of no concern to us.
*/ */
if (mm == NULL || mm == &init_mm) if (mm == NULL)
return 1; return 1;
__oom_kill_task(p, message); __oom_kill_task(p, message);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment