oom: oom_kill_process() doesn't select kthread child
authorKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Tue, 10 Aug 2010 00:19:34 +0000 (17:19 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 10 Aug 2010 03:45:01 +0000 (20:45 -0700)
Presently select_bad_process() has a PF_KTHREAD check, but
oom_kill_process doesn't.  It mean oom_kill_process() may choose wrong
task, especially, when the child are using use_mm().

Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Reviewed-by: Minchan Kim <minchan.kim@gmail.com>
Cc: David Rientjes <rientjes@google.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/oom_kill.c

index 6e9f16a910e06741e6fdb8da92a4bfa0b1149f65..b9816ea2eb8f7dbd3d89cd0b435f81ee9efc7480 100644 (file)
@@ -467,6 +467,8 @@ static int oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
 
                        if (child->mm == p->mm)
                                continue;
+                       if (child->flags & PF_KTHREAD)
+                               continue;
                        if (mem && !task_in_mem_cgroup(child, mem))
                                continue;
                        if (!has_intersects_mems_allowed(child, nodemask))