diff options
author | David Rientjes <rientjes@google.com> | 2011-03-22 16:30:12 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-22 17:43:58 -0700 |
commit | edd45544c6f09550df0a5491aa8a07af24767e73 (patch) | |
tree | a44ec26701ed430b68ee3b045b6575462d15af71 /kernel/cgroup.c | |
parent | 30e2b41f20b6238f51e7cffb879c7a0f0073f5fe (diff) | |
download | kernel_samsung_tuna-edd45544c6f09550df0a5491aa8a07af24767e73.zip kernel_samsung_tuna-edd45544c6f09550df0a5491aa8a07af24767e73.tar.gz kernel_samsung_tuna-edd45544c6f09550df0a5491aa8a07af24767e73.tar.bz2 |
oom: avoid deferring oom killer if exiting task is being traced
The oom killer naturally defers killing anything if it finds an eligible
task that is already exiting and has yet to detach its ->mm. This avoids
unnecessarily killing tasks when one is already in the exit path and may
free enough memory that the oom killer is no longer needed. This is
detected by PF_EXITING since threads that have already detached its ->mm
are no longer considered at all.
The problem with always deferring when a thread is PF_EXITING, however, is
that it may never actually exit when being traced, specifically if another
task is tracing it with PTRACE_O_TRACEEXIT. The oom killer does not want
to defer in this case since there is no guarantee that thread will ever
exit without intervention.
This patch will now only defer the oom killer when a thread is PF_EXITING
and no ptracer has stopped its progress in the exit path. It also ensures
that a child is sacrificed for the chosen parent only if it has a
different ->mm as the comment implies: this ensures that the thread group
leader is always targeted appropriately.
Signed-off-by: David Rientjes <rientjes@google.com>
Reported-by: Oleg Nesterov <oleg@redhat.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Andrey Vagin <avagin@openvz.org>
Cc: <stable@kernel.org> [2.6.38.x]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/cgroup.c')
0 files changed, 0 insertions, 0 deletions