[PATCH] oom: kthread infinite loop fix
authorNick Piggin <npiggin@suse.de>
Tue, 26 Sep 2006 06:31:32 +0000 (23:31 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 26 Sep 2006 15:48:49 +0000 (08:48 -0700)
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 <npiggin@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
mm/oom_kill.c

index f1aba7e7b760b0a8533ef39d11897a29d2523165..12cd4735dc2935afda3b60f0753b0ec5ce212b2d 100644 (file)
@@ -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;