From: Nick Piggin Date: Tue, 26 Sep 2006 06:31:32 +0000 (-0700) Subject: [PATCH] oom: kthread infinite loop fix X-Git-Tag: firefly_0821_release~33558 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=5081dde33f7a61d28d9b185cc386f12cb837c7a4;p=firefly-linux-kernel-4.4.55.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 f1aba7e7b760..12cd4735dc29 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;