]> 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>
Fri, 30 Sep 2011 04:53:19 +0000 (14:53 +1000)
commit8f9065f26e276bfef89105cdc584eb4a41aba411
tree1b1867f64440943f51f51efbb676d1683bcc6d5f
parent97c17064534bcf0e03f76c818258f66102b90907
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