]> git.karo-electronics.de Git - karo-tx-linux.git/commit
oom: avoid killing kthreads if they assume the oom killed thread's mm
authorDavid Rientjes <rientjes@google.com>
Wed, 28 Sep 2011 00:50:02 +0000 (10:50 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 29 Sep 2011 06:08:00 +0000 (16:08 +1000)
commit8489f589615502f4b749a36e68bd76d1eee6d8cc
treedb3dc05ce7a51c4f53afd175b36296a060a125d9
parent5f218410260ef9a33ec19ea27ce23c656f88cc41
oom: avoid killing kthreads if they assume the oom killed thread's mm

After selecting a task to kill, the oom killer iterates all processes and
kills all other threads that share the same mm_struct in different thread
groups.  It would not otherwise be helpful to kill a thread if its memory
would not be subsequently freed.

A kernel thread, however, may assume a user thread's mm by using
use_mm().  This is only temporary and should not result in sending a
SIGKILL to that kthread.

This patch ensures that only user threads and not kthreads are sent a
SIGKILL if they share the same mm_struct as the oom killed task.

Signed-off-by: David Rientjes <rientjes@google.com>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Andrew Morton <>
mm/oom_kill.c