Skip to content

Commit

Permalink
oom: check PF_KTHREAD instead of !mm to skip kthreads
Browse files Browse the repository at this point in the history
select_bad_process() thinks a kernel thread can't have ->mm != NULL, this
is not true due to use_mm().

Change the code to check PF_KTHREAD.

Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: David Rientjes <rientjes@google.com>
Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Aug 10, 2010
1 parent a9877cc commit 455c0e5
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions mm/oom_kill.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,14 +256,11 @@ static struct task_struct *select_bad_process(unsigned long *ppoints,
for_each_process(p) {
unsigned long points;

/*
* skip kernel threads and tasks which have already released
* their mm.
*/
/* skip tasks that have already released their mm */
if (!p->mm)
continue;
/* skip the init task */
if (is_global_init(p))
/* skip the init task and kthreads */
if (is_global_init(p) || (p->flags & PF_KTHREAD))
continue;
if (mem && !task_in_mem_cgroup(p, mem))
continue;
Expand Down

0 comments on commit 455c0e5

Please sign in to comment.