diff options
author | Andrey Vagin <avagin@openvz.org> | 2011-03-22 19:30:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-22 20:43:58 -0400 |
commit | 30e2b41f20b6238f51e7cffb879c7a0f0073f5fe (patch) | |
tree | fc1bdcfd516bbf67cf6c5c36f903a299c1ac03df | |
parent | 3a5dda7a17cf3706f79b86293f29db02d61e0d48 (diff) |
oom: skip zombies when iterating tasklist
We shouldn't defer oom killing if a thread has already detached its ->mm
and still has TIF_MEMDIE set. Memory needs to be freed, so find kill
other threads that pin the same ->mm or find another task to kill.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: David Rientjes <rientjes@google.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
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>
-rw-r--r-- | mm/oom_kill.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index b5a7b5f46e7a..d7f345e47e73 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c | |||
@@ -299,6 +299,8 @@ static struct task_struct *select_bad_process(unsigned int *ppoints, | |||
299 | do_each_thread(g, p) { | 299 | do_each_thread(g, p) { |
300 | unsigned int points; | 300 | unsigned int points; |
301 | 301 | ||
302 | if (!p->mm) | ||
303 | continue; | ||
302 | if (oom_unkillable_task(p, mem, nodemask)) | 304 | if (oom_unkillable_task(p, mem, nodemask)) |
303 | continue; | 305 | continue; |
304 | 306 | ||
@@ -324,7 +326,7 @@ static struct task_struct *select_bad_process(unsigned int *ppoints, | |||
324 | * the process of exiting and releasing its resources. | 326 | * the process of exiting and releasing its resources. |
325 | * Otherwise we could get an easy OOM deadlock. | 327 | * Otherwise we could get an easy OOM deadlock. |
326 | */ | 328 | */ |
327 | if ((p->flags & PF_EXITING) && p->mm) { | 329 | if (p->flags & PF_EXITING) { |
328 | if (p != current) | 330 | if (p != current) |
329 | return ERR_PTR(-1UL); | 331 | return ERR_PTR(-1UL); |
330 | 332 | ||