From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932887AbcE3In6 (ORCPT ); Mon, 30 May 2016 04:43:58 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:48133 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932691AbcE3In5 (ORCPT ); Mon, 30 May 2016 04:43:57 -0400 Date: Mon, 30 May 2016 10:43:46 +0200 From: Peter Zijlstra To: Sebastian Andrzej Siewior Cc: Thomas Gleixner , LKML , Sebastian Andrzej Siewior , Linus Torvalds , Darren Hart , Ingo Molnar , Michael Kerrisk , Davidlohr Bueso , Chris Mason , "Carlos O'Donell" , Torvald Riegel , Eric Dumazet Subject: Re: [patch V2 2/7] futex: Hash private futexes per process Message-ID: <20160530084346.GM3192@twins.programming.kicks-ass.net> References: <20160505204230.932454245@linutronix.de> <20160505204353.973009518@linutronix.de> <20160519122148.GZ3192@twins.programming.kicks-ass.net> <20160527165211.GB28561@breakpoint.cc> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20160527165211.GB28561@breakpoint.cc> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.