From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933349AbbELNBD (ORCPT ); Tue, 12 May 2015 09:01:03 -0400 Received: from casper.infradead.org ([85.118.1.10]:36164 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932789AbbELNA6 (ORCPT ); Tue, 12 May 2015 09:00:58 -0400 Date: Tue, 12 May 2015 15:00:43 +0200 From: Peter Zijlstra To: Linus Torvalds Cc: Douglas Hatch , Thomas Gleixner , Ingo Molnar , Waiman Long , Linux Kernel Mailing List , "Norton, Scott J" , Peter Anvin , "linux-tip-commits@vger.kernel.org" Subject: Re: [tip:locking/core] locking/pvqspinlock: Replace xchg() by the more descriptive set_mb() Message-ID: <20150512130043.GF16478@twins.programming.kicks-ass.net> References: <20150511145408.GU27504@twins.programming.kicks-ass.net> <20150512084529.GC21418@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150512084529.GC21418@twins.programming.kicks-ass.net> 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 Tue, May 12, 2015 at 10:45:29AM +0200, Peter Zijlstra wrote: > On Mon, May 11, 2015 at 10:50:42AM -0700, Linus Torvalds wrote: > > On Mon, May 11, 2015 at 7:54 AM, Peter Zijlstra wrote: > > > > > > Hmm, so I looked at the set_mb() definitions and I figure we want to do > > > something like the below, right? > > > > I don't think you need to do this for the non-smp cases. > > Well, its the store tearing thing again, we use WRITE_ONCE() in > smp_store_release() for the same reason. We want it to be a single > store. > > > The whole > > thing is about smp memory ordering, so on UP you don't even need the > > WRITE_ONCE(), much less a barrier. Ah, you meant the memory barrier; indeed, a compiler barrier is sufficient. I got somewhat confused between Waiman's email and barrier and barrier() (again!).