oom: oom_kill_process() doesn't select kthread child
KOSAKI Motohiro [Tue, 10 Aug 2010 00:19:34 +0000 (17:19 -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 6e9f16a..b9816ea 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))