Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932643Ab0FQBwr (ORCPT ); Wed, 16 Jun 2010 21:52:47 -0400 Received: from fgwmail5.fujitsu.co.jp ([192.51.44.35]:39316 "EHLO fgwmail5.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759565Ab0FQBvt (ORCPT ); Wed, 16 Jun 2010 21:51:49 -0400 X-SecurityPolicyCheck-FJ: OK by FujitsuOutboundMailChecker v1.3.1 From: KOSAKI Motohiro To: LKML , linux-mm , Andrew Morton , David Rientjes , Minchan Kim , KAMEZAWA Hiroyuki , Oleg Nesterov Subject: [PATCH 9/9] oom: multi threaded process coredump don't make deadlock Cc: kosaki.motohiro@jp.fujitsu.com In-Reply-To: <20100617104311.FB7A.A69D9226@jp.fujitsu.com> References: <20100617104311.FB7A.A69D9226@jp.fujitsu.com> Message-Id: <20100617104953.FB98.A69D9226@jp.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-2022-JP" Content-Transfer-Encoding: 7bit X-Mailer: Becky! ver. 2.50.07 [ja] Date: Thu, 17 Jun 2010 10:51:44 +0900 (JST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1508 Lines: 44 Oleg pointed out current PF_EXITING check is wrong. Because PF_EXITING is per-thread flag, not per-process flag. He said, Two threads, group-leader L and its sub-thread T. T dumps the code. In this case both threads have ->mm != NULL, L has PF_EXITING. The first problem is, select_bad_process() always return -1 in this case (even if the caller is T, this doesn't matter). The second problem is that we should add TIF_MEMDIE to T, not L. I think we can remove this dubious PF_EXITING check. but as first step, This patch add the protection of multi threaded issue. Cc: Oleg Nesterov Signed-off-by: KOSAKI Motohiro --- mm/oom_kill.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/mm/oom_kill.c b/mm/oom_kill.c index b2ea2d8..4abc5c1 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -353,7 +353,7 @@ static struct task_struct *select_bad_process(unsigned long *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 (thread_group_empty(p) && (p->flags & PF_EXITING) && p->mm) { if (p != current) return ERR_PTR(-1UL); -- 1.6.5.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/