From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755158AbcA1Sfi (ORCPT ); Thu, 28 Jan 2016 13:35:38 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:51166 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752271AbcA1Sff (ORCPT ); Thu, 28 Jan 2016 13:35:35 -0500 Date: Thu, 28 Jan 2016 19:35:26 +0100 From: Peter Zijlstra To: Waiman Long Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Alexander Viro , linux-fsdevel@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, Scott J Norton , Douglas Hatch Subject: Re: [RFC PATCH 1/3] lib/list_batch: A simple list insertion/deletion batching facility Message-ID: <20160128183526.GX6356@twins.programming.kicks-ass.net> References: <1453824219-51437-1-git-send-email-Waiman.Long@hpe.com> <1453824219-51437-2-git-send-email-Waiman.Long@hpe.com> <20160127163450.GU6357@twins.programming.kicks-ass.net> <56A926FB.80609@hpe.com> <20160127205400.GZ6357@twins.programming.kicks-ass.net> <56AA45B4.20401@hpe.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56AA45B4.20401@hpe.com> 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 Thu, Jan 28, 2016 at 11:45:40AM -0500, Waiman Long wrote: > Using xchg_release() looks OK to me. As this feature is enabled on x86 only > for this patch, we can make the change and whoever enabling it for other > architectures that have a real release function will have to test it. Ah, I was more thinking about: /* * We rely on the memory barrier implied by xchg() below to * ensure the node initialization is complete before its * published. */ And then use xchg() like you already do. > >READ/WRITE_ONCE() provide _no_ order what so ever. And the issue here is > >that we must not do any other stores to nptr after the state_done. > > > > I thought if those macros are accessing the same cacheline, the compiler > won't change the ordering and the hardware will take care of the proper > ordering. Anyway, I do intended to change to use smp_store_release() for > safety. The macros use a volatile cast, and that ensures the compiler must emit the store and must emit it as a single store. I'm not 100% sure on the rules of the compiler reordering volatile accesses, they are not a compiler barrier.