[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <793911432719763@web2o.yandex.ru>
Date: Wed, 27 May 2015 12:42:43 +0300
From: Kirill Tkhai <tkhai@...dex.ru>
To: Oleg Nesterov <oleg@...hat.com>, Kirill Tkhai <ktkhai@...n.com>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Michal Hocko <mhocko@...e.cz>, Rik van Riel <riel@...hat.com>,
Ionut Alexa <ionut.m.alexa@...il.com>,
Peter Hurley <peter@...leysoftware.com>
Subject: Re: [PATCH RFC 09/13] exit: Use for_each_thread() in do_wait()
27.05.2015, 12:34, "Kirill Tkhai" <tkhai@...dex.ru>:
> 26.05.2015, 22:47, "Oleg Nesterov" <oleg@...hat.com>:
>> 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?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists