[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190718110446.GC3419@hirez.programming.kicks-ass.net>
Date: Thu, 18 Jul 2019 13:04:46 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Jan Stancek <jstancek@...hat.com>
Cc: Will Deacon <will@...nel.org>, Waiman Long <longman@...hat.com>,
linux-kernel@...r.kernel.org, dbueso@...e.de, mingo@...hat.com,
jade alglave <jade.alglave@....com>, paulmck@...ux.vnet.ibm.com
Subject: Re: [PATCH v2] locking/rwsem: add acquire barrier to read_slowpath
exit when queue is empty
On Thu, Jul 18, 2019 at 06:50:52AM -0400, Jan Stancek wrote:
> > In writing this, I also noticed that we don't have any explicit ordering
> > at the end of the reader slowpath when we wait on the queue but get woken
> > immediately:
> >
> > if (!waiter.task)
> > break;
> >
> > Am I missing something?
>
> I'm assuming this isn't problem, because set_current_state() on line above
> is using smp_store_mb().
X = 0;
X = 1;
rwsem_down_read() rwsem_up_write();
for (;;) {
set_current_state(TASK_UNINTERRUPTIBLE);
rwsem_mark_wake()
atomic_long_add(adjustment, &sem->count);
smp_store_release(&waiter->task, NULL);
if (!waiter.task)
break;
...
}
r = X;
can I think result in r==0 just fine, because there's nothing ordering
the load of waiter.task with the store of X.
It is exceedingly unlikely, but not impossible afaict.
Powered by blists - more mailing lists