Skip to content

Commit

Permalink
oom: skip zombies when iterating tasklist
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andrey Vagin authored and Linus Torvalds committed Mar 23, 2011
1 parent 3a5dda7 commit 30e2b41
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mm/oom_kill.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ static struct task_struct *select_bad_process(unsigned int *ppoints,
do_each_thread(g, p) {
unsigned int points;

if (!p->mm)
continue;
if (oom_unkillable_task(p, mem, nodemask))
continue;

Expand All @@ -324,7 +326,7 @@ static struct task_struct *select_bad_process(unsigned int *ppoints,
* the process of exiting and releasing its resources.
* Otherwise we could get an easy OOM deadlock.
*/
if ((p->flags & PF_EXITING) && p->mm) {
if (p->flags & PF_EXITING) {
if (p != current)
return ERR_PTR(-1UL);

Expand Down

0 comments on commit 30e2b41

Please sign in to comment.