From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752340AbbE0JnQ (ORCPT ); Wed, 27 May 2015 05:43:16 -0400 Received: from forward14o.cmail.yandex.net ([37.9.109.194]:51602 "EHLO forward14o.cmail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752013AbbE0JnM (ORCPT ); Wed, 27 May 2015 05:43:12 -0400 From: Kirill Tkhai To: Oleg Nesterov , Kirill Tkhai Cc: "linux-kernel@vger.kernel.org" , Andrew Morton , Ingo Molnar , Peter Zijlstra , Michal Hocko , Rik van Riel , Ionut Alexa , Peter Hurley In-Reply-To: <734911432719229@web2o.yandex.ru> References: <20150525162722.5171.15901.stgit@pro> <1432575941.6866.42.camel@odin.com> <20150526194613.GC6978@redhat.com> <734911432719229@web2o.yandex.ru> Subject: Re: [PATCH RFC 09/13] exit: Use for_each_thread() in do_wait() MIME-Version: 1.0 Message-Id: <793911432719763@web2o.yandex.ru> X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Wed, 27 May 2015 12:42:43 +0300 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=koi8-r Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 27.05.2015, 12:34, "Kirill Tkhai" : > 26.05.2015, 22:47, "Oleg Nesterov" : >> šOn 05/25, Kirill Tkhai wrote: >>> ššRefactoring, no functionality change. >> šHmm. unless I missed something this change is wrong. >>> šš--- a/kernel/exit.c >>> šš+++ b/kernel/exit.c >>> šš@@ -1538,8 +1538,7 @@ static long do_wait(struct wait_opts *wo) >>> >>> šššššššššššset_current_state(TASK_INTERRUPTIBLE); >>> šššššššššššread_lock(&tasklist_lock); >>> šš- tsk = current; >>> šš- do { >>> šš+ for_each_thread(current, tsk) { >>> šššššššššššššššššššretval = do_wait_thread(wo, tsk); >>> šššššššššššššššššššif (retval) >>> šššššššššššššššššššššššššššgoto end; >>> šš@@ -1550,7 +1549,7 @@ static long do_wait(struct wait_opts *wo) >>> >>> šššššššššššššššššššif (wo->wo_flags & __WNOTHREAD) >>> šššššššššššššššššššššššššššbreak; >>> šš- } while_each_thread(current, tsk); >>> šš+ } >> šPlease note the __WNOTHREAD check. This is the rare case when we >> šactually want while_each_thread() (although it should die anyway). >> >> šfor_each_thread() always starts from ->group_leader, but we need >> što start from "current" first. > > Sure, this must be like below. Thanks! > I won't resend the whole series with only this one patch changed to > do not bomb mail boxes. Waiting for the review. > > diff --git a/kernel/exit.c b/kernel/exit.c > index a268093..e4963d3 100644 > --- a/kernel/exit.c > +++ b/kernel/exit.c > @@ -1538,8 +1538,10 @@ static long do_wait(struct wait_opts *wo) > > šššššššššset_current_state(TASK_INTERRUPTIBLE); > šššššššššread_lock(&tasklist_lock); > - tsk = current; > - do { > + for_each_thread(current, tsk) { > + if (wo->wo_flags & __WNOTHREAD) > + tsk = current; > + > šššššššššššššššššretval = do_wait_thread(wo, tsk); > šššššššššššššššššif (retval) > šššššššššššššššššššššššššgoto end; > @@ -1550,7 +1552,7 @@ static long do_wait(struct wait_opts *wo) > > šššššššššššššššššif (wo->wo_flags & __WNOTHREAD) > šššššššššššššššššššššššššbreak; > - } while_each_thread(current, tsk); > + } > šššššššššread_unlock(&tasklist_lock); > > šnotask: Hm. Once again. Is the problem in __WNOTHREAD only? Should we firstly reap our own children in common case?