From: Kirill Tkhai <tkhai@yandex.ru>
To: Oleg Nesterov <oleg@redhat.com>, Kirill Tkhai <ktkhai@odin.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Michal Hocko <mhocko@suse.cz>, Rik van Riel <riel@redhat.com>,
Ionut Alexa <ionut.m.alexa@gmail.com>,
Peter Hurley <peter@hurleysoftware.com>
Subject: Re: [PATCH RFC 09/13] exit: Use for_each_thread() in do_wait()
Date: Wed, 27 May 2015 12:33:49 +0300 [thread overview]
Message-ID: <734911432719229@web2o.yandex.ru> (raw)
In-Reply-To: <20150526194613.GC6978@redhat.com>
26.05.2015, 22:47, "Oleg Nesterov" <oleg@redhat.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:
next prev parent reply other threads:[~2015-05-27 9:33 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20150525162722.5171.15901.stgit@pro>
2015-05-25 17:44 ` [PATCH RFC 01/13] exit: Clarify choice of new parent in forget_original_parent() Kirill Tkhai
2015-05-25 17:44 ` [PATCH RFC 02/13] rwlock_t: Implement double_write_{,un}lock() Kirill Tkhai
2015-05-25 17:44 ` [PATCH RFC 03/13] pid_ns: Implement rwlock_t pid_ns::cr_lock for locking child_reaper Kirill Tkhai
2015-05-25 17:44 ` [PATCH RFC 04/13] exit: Small refactoring mm_update_next_owner() Kirill Tkhai
2015-05-25 17:45 ` [PATCH RFC 05/13] fs: Refactoring in get_children_pid() Kirill Tkhai
2015-05-25 17:45 ` [PATCH RFC 06/13] core: Add rwlock_t task_list::kin_lock Kirill Tkhai
2015-05-25 17:45 ` [PATCH RFC 07/13] kin_lock: Implement helpers for kin_lock locking Kirill Tkhai
2015-05-25 17:45 ` [PATCH RFC 08/13] core: Use kin_lock synchronizations between parent and child and for thread group Kirill Tkhai
2015-05-25 17:45 ` [PATCH RFC 09/13] exit: Use for_each_thread() in do_wait() Kirill Tkhai
2015-05-26 19:46 ` Oleg Nesterov
2015-05-27 9:33 ` Kirill Tkhai [this message]
2015-05-27 9:42 ` Kirill Tkhai
2015-05-25 17:45 ` [PATCH RFC 10/13] exit: Add struct wait_opts's member held_lock and use it for tasklist_lock Kirill Tkhai
2015-05-25 17:46 ` [PATCH RFC 11/13] exit: Syncronize on kin_lock while do_notify_parent() Kirill Tkhai
2015-05-25 17:46 ` [PATCH RFC 12/13] exit: Delete write dependence on tasklist_lock in exit_notify() Kirill Tkhai
2015-05-25 17:46 ` [PATCH RFC 13/13] core: Nest tasklist_lock into task_struct::kin_lock Kirill Tkhai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=734911432719229@web2o.yandex.ru \
--to=tkhai@yandex.ru \
--cc=akpm@linux-foundation.org \
--cc=ionut.m.alexa@gmail.com \
--cc=ktkhai@odin.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mhocko@suse.cz \
--cc=mingo@redhat.com \
--cc=oleg@redhat.com \
--cc=peter@hurleysoftware.com \
--cc=peterz@infradead.org \
--cc=riel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox