From: Nick Piggin 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 --- mm/oom_kill.c | 3 +++ 1 file changed, 3 insertions(+) diff -puN mm/oom_kill.c~oom-kthread-infinite-loop-fix mm/oom_kill.c --- a/mm/oom_kill.c~oom-kthread-infinite-loop-fix +++ a/mm/oom_kill.c @@ -207,6 +207,9 @@ static struct task_struct *select_bad_pr unsigned long points; int releasing; + /* skip kernel threads */ + if (!p->mm) + continue; /* skip the init task with pid == 1 */ if (p->pid == 1) continue; _