]> git.kernelconcepts.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>
Thu, 13 Oct 2011 06:49:18 +0000 (17:49 +1100)
commit43be37d3ac34a156306a8eb624d50c6844bfa64e
tree72763d643eb5fba82cda0f4e36216ca2c1a7592b
parent17dc5cfc5d2635ba5eb1bf707e2b9dad78dce5f0
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