]> 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, 5 Oct 2011 00:42:49 +0000 (11:42 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 7 Oct 2011 06:06:33 +0000 (17:06 +1100)
commit814e56b96ba40691daac53a9f3996e8de9105b18
tree51406c3013a36775bd1776a6b7e11fe8bb48bf00
parentad7c3dc3afeedefef57acd19f329d02a15d429e7
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 <akpm@linux-foundation.org>
mm/oom_kill.c