From: Nick Piggin Date: Tue, 26 Sep 2006 06:31:32 +0000 (-0700) Subject: [PATCH] oom: kthread infinite loop fix X-Git-Tag: v2.6.19-rc1~1184 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=5081dde33f7a61d28d9b185cc386f12cb837c7a4;p=~emulex%2Finfiniband.git [PATCH] oom: kthread infinite loop fix Skip kernel threads, rather than having them return 0 from badness. Theoretically, badness might truncate all results to 0, thus a kernel thread might be picked first, causing an infinite loop. Signed-off-by: Nick Piggin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/oom_kill.c b/mm/oom_kill.c index f1aba7e7b76..12cd4735dc2 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -207,6 +207,9 @@ static struct task_struct *select_bad_process(unsigned long *ppoints) unsigned long points; int releasing; + /* skip kernel threads */ + if (!p->mm) + continue; /* skip the init task with pid == 1 */ if (p->pid == 1) continue;