]> 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>
Wed, 12 Oct 2011 06:32:01 +0000 (17:32 +1100)
commit01e852bd97431c9e6cdb799cf37bcff5487ec26b
treedbff8fc69c1f6de277d5e0b018fc6cc35fa6f527
parent7e345962e4183673e5482b1be755f411cdea7158
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