[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160530084346.GM3192@twins.programming.kicks-ass.net>
Date: Mon, 30 May 2016 10:43:46 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Sebastian Andrzej Siewior <sebastian@...akpoint.cc>
Cc: Thomas Gleixner <tglx@...utronix.de>,
LKML <linux-kernel@...r.kernel.org>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Darren Hart <darren@...art.com>,
Ingo Molnar <mingo@...nel.org>,
Michael Kerrisk <mtk.manpages@...glemail.com>,
Davidlohr Bueso <dave@...olabs.net>, Chris Mason <clm@...com>,
Carlos O'Donell <carlos@...hat.com>,
Torvald Riegel <triegel@...hat.com>,
Eric Dumazet <edumazet@...gle.com>
Subject: Re: [patch V2 2/7] futex: Hash private futexes per process
On Fri, May 27, 2016 at 06:52:11PM +0200, Sebastian Andrzej Siewior wrote:
> On 2016-05-19 14:21:48 [+0200], Peter Zijlstra wrote:
> > > +static void futex_populate_hash(unsigned int hash_bits)
> > > +{
> …
> > > + raw_spin_lock(&mm->futex_hash.lock);
> > > + /* We might have raced with another task allocating the hash. */
> > > + if (!mm->futex_hash.hash) {
> > > + mm->futex_hash.hash_bits = hash_bits;
> > > + /*
> > > + * Ensure that the above is visible before we store
> > > + * the pointer.
> > > + */
> > > + smp_wmb(); /* (A0) Pairs with (B) */
> > > + mm->futex_hash.hash = hb;
> >
> > smp_store_release(&mm->futex_hash.hash, hb); ?
>
> just to be clear: You suggest to use "smp_store_release()" instead
> smp_wmb() followed by the assignment?
Yes, smp_store_release() is the most natural way to publish things like
this. Note that rcu_assign_pointer() also switched to using that. See
commit: 88c1863066cc ("rcu: Define rcu_assign_pointer() in terms of
smp_store_release()") for detail on the difference.
Powered by blists - more mailing lists