[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180911114429.GT24106@hirez.programming.kicks-ass.net>
Date: Tue, 11 Sep 2018 13:44:29 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
Cc: Dmitry Safonov <dima@...sta.com>, linux-kernel@...r.kernel.org,
Dmitry Safonov <0x7f454c46@...il.com>,
Daniel Axtens <dja@...ens.net>,
Dmitry Vyukov <dvyukov@...gle.com>,
Michael Neuling <mikey@...ling.org>,
Mikulas Patocka <mpatocka@...hat.com>,
Nathan March <nathan@...net>,
Pasi Kärkkäinen <pasik@....fi>,
Peter Hurley <peter@...leysoftware.com>,
"Rong, Chen" <rong.a.chen@...el.com>,
Tan Xiaojun <tanxiaojun@...wei.com>,
Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>,
stable@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jslaby@...e.com>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
Subject: Re: [PATCHv3 2/6] tty/ldsem: Update waiter->task before waking up
reader
On Tue, Sep 11, 2018 at 02:41:29PM +0900, Sergey Senozhatsky wrote:
> On (09/11/18 14:04), Sergey Senozhatsky wrote:
> > > for (;;) {
> > > set_current_state(TASK_UNINTERRUPTIBLE);
> >
> > I think that set_current_state() also executes memory barrier. Just
> > because it accesses task state.
> >
> > > - if (!waiter.task)
> > > + if (!READ_ONCE(waiter.task))
> > > break;
> > > if (!timeout)
> > > break;
>
> This READ_ONCE(waiter.task) looks interesting. Maybe could be moved
> to a loop condition
>
> while (!READ_ONCE(waiter.task)) {
> ...
> }
No, it must be after set_current_state(). See that same comment.
Powered by blists - more mailing lists