提交 30e2b41f 编写于 作者: A Andrey Vagin 提交者: Linus Torvalds

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: NAndrey Vagin <avagin@openvz.org>
Signed-off-by: NDavid Rientjes <rientjes@google.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: <stable@kernel.org>		[2.6.38.x]
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 3a5dda7a
...@@ -299,6 +299,8 @@ static struct task_struct *select_bad_process(unsigned int *ppoints, ...@@ -299,6 +299,8 @@ static struct task_struct *select_bad_process(unsigned int *ppoints,
do_each_thread(g, p) { do_each_thread(g, p) {
unsigned int points; unsigned int points;
if (!p->mm)
continue;
if (oom_unkillable_task(p, mem, nodemask)) if (oom_unkillable_task(p, mem, nodemask))
continue; continue;
...@@ -324,7 +326,7 @@ static struct task_struct *select_bad_process(unsigned int *ppoints, ...@@ -324,7 +326,7 @@ static struct task_struct *select_bad_process(unsigned int *ppoints,
* the process of exiting and releasing its resources. * the process of exiting and releasing its resources.
* Otherwise we could get an easy OOM deadlock. * Otherwise we could get an easy OOM deadlock.
*/ */
if ((p->flags & PF_EXITING) && p->mm) { if (p->flags & PF_EXITING) {
if (p != current) if (p != current)
return ERR_PTR(-1UL); return ERR_PTR(-1UL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册