From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755418AbbCBTqX (ORCPT ); Mon, 2 Mar 2015 14:46:23 -0500 Received: from e35.co.us.ibm.com ([32.97.110.153]:33404 "EHLO e35.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754917AbbCBTqU (ORCPT ); Mon, 2 Mar 2015 14:46:20 -0500 Date: Mon, 2 Mar 2015 11:46:13 -0800 From: "Paul E. McKenney" To: Peter Zijlstra Cc: Mathieu Desnoyers , mingo@kernel.org, rusty@rustcorp.com.au, oleg@redhat.com, linux-kernel@vger.kernel.org, andi@firstfloor.org, rostedt@goodmis.org, tglx@linutronix.de, Michel Lespinasse , Andrea Arcangeli , David Woodhouse , Rik van Riel Subject: Re: [RFC][PATCH 6/9] seqlock: Better document raw_write_seqcount_latch() Message-ID: <20150302194613.GV15405@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com References: <20150228212447.381543289@infradead.org> <20150228213110.188801887@infradead.org> <1524903258.193820.1425218543344.JavaMail.zimbra@efficios.com> <20150302083320.GC5029@twins.programming.kicks-ass.net> <20150302085116.GD24151@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150302085116.GD24151@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15030219-0013-0000-0000-0000092692D1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 02, 2015 at 09:51:16AM +0100, Peter Zijlstra wrote: > On Mon, Mar 02, 2015 at 09:33:20AM +0100, Peter Zijlstra wrote: > > On Sun, Mar 01, 2015 at 02:02:23PM +0000, Mathieu Desnoyers wrote: > > > > The latch, AFAIU, takes care of making sure the new objects are > > > initialized before being published into the data structure, so there > > > would be no need to use RCU assign pointer. However, we really need > > > RCU around reads, along with a grace period between removal of an object > > > and its teardown. > > > > So I do need the rcu_assign_pointer for the RB link because that also > > initializes the rb_node itself. Or put differently, be _very_ _VERY_ > > sure your entire object is initialized before the latch. > > > > Secondly, note that the latch does a WMB and rcu_assign_pointer does a > > RELEASE, these are not equivalent. > > > > So I don't think I will highlight this particular point. If you're sure > > enough to know the difference you can get away with it, sure. But in > > general I think people should still use rcu_assign_pointer; if only to > > make Paul sleep better at night ;-) I do appreciate that sentiment. ;-) > Also note that if you do not use rcu_assign_pointer() one will at the > very least require WRITE_ONCE(). And, for ARM, IA64, and PowerPC, memory-barrier instructions. Thanx, Paul