Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753148AbbBWUUA (ORCPT ); Mon, 23 Feb 2015 15:20:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33334 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753101AbbBWUT6 (ORCPT ); Mon, 23 Feb 2015 15:19:58 -0500 Date: Mon, 23 Feb 2015 21:18:25 +0100 From: Oleg Nesterov To: Kirill Tkhai Cc: linux-kernel@vger.kernel.org, Andrew Morton , tkhai@yandex.ru Subject: Re: [PATCH] de_thread: Move notify_count write under lock Message-ID: <20150223201825.GA25430@redhat.com> References: <1423142000.6933.3.camel@tkhai> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1423142000.6933.3.camel@tkhai> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1867 Lines: 52 I still think that the changelog and the comment look a bit confusing... it could simply say that exit_notify() can see these STORE's out of order. And we can set ->notify_count after ->exit_state check, but again this is cosmetic, I won't insist. The main problem with this patch is that it was ignored ;) Kirill, could you resend? Feel free to add my ack. On 02/05, Kirill Tkhai wrote: > > The write operation may be reordered with the setting of group_exit_task. > If so, this fires in exit_notify(). > > Looks like, it's not good to add smp barriers for this case, especially > in exit_notify(), so let's put the notify_count write under write lock. > > Signed-off-by: Kirill Tkhai > --- > fs/exec.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/fs/exec.c b/fs/exec.c > index ad8798e..42782d5 100644 > --- a/fs/exec.c > +++ b/fs/exec.c > @@ -920,10 +920,16 @@ static int de_thread(struct task_struct *tsk) > if (!thread_group_leader(tsk)) { > struct task_struct *leader = tsk->group_leader; > > - sig->notify_count = -1; /* for exit_notify() */ > for (;;) { > threadgroup_change_begin(tsk); > write_lock_irq(&tasklist_lock); > + /* > + * We could set it once outside the for() cycle, but > + * this requires to use SMP barriers there and in > + * exit_notify(), because the write operation may > + * be reordered with the setting of group_exit_task. > + */ > + sig->notify_count = -1; /* for exit_notify() */ > if (likely(leader->exit_state)) > break; > __set_current_state(TASK_KILLABLE); > > > -- 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/