After selecting a task to kill, the oom killer iterates all processes and
commit3bfd5faf571cf8e4abc52be09eb4f2f5e0155eae
authorDavid Rientjes <rientjes@google.com>
Wed, 24 Aug 2011 23:46:49 +0000 (25 09:46 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 25 Aug 2011 05:34:16 +0000 (25 15:34 +1000)
tree6de1bb9446c4c49f486339483b54bea4c7ecd7ea
parent6356c397c6a28cd306e60e528bde4d09a370299c
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