From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751550AbbDMTSU (ORCPT ); Mon, 13 Apr 2015 15:18:20 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:36622 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751223AbbDMTSQ (ORCPT ); Mon, 13 Apr 2015 15:18:16 -0400 Date: Mon, 13 Apr 2015 21:17:50 +0200 From: Peter Zijlstra To: Ingo Molnar Cc: rusty@rustcorp.com.au, mathieu.desnoyers@efficios.com, oleg@redhat.com, paulmck@linux.vnet.ibm.com, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, andi@firstfloor.org, rostedt@goodmis.org, tglx@linutronix.de, laijs@cn.fujitsu.com, linux@horizon.com, Andrea Arcangeli , David Woodhouse , Rik van Riel , Michel Lespinasse Subject: Re: [PATCH v5 05/10] seqlock: Better document raw_write_seqcount_latch() Message-ID: <20150413191750.GK23123@twins.programming.kicks-ass.net> References: <20150413141126.756350256@infradead.org> <20150413141213.492831596@infradead.org> <20150413163201.GC6040@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150413163201.GC6040@gmail.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 Mon, Apr 13, 2015 at 06:32:02PM +0200, Ingo Molnar wrote: > > Btw., I realize this is just a sample, but couldn't this be written > more optimally as: > > do { > seq = READ_ONCE(latch->seq); > smp_read_barrier_depends(); > > idx = seq & 0x01; > entry = data_query(latch->data[idx], ...); > > smp_rmb(); > } while (seq != latch->seq); > So in the actual code we use raw_read_seqcount() which includes the rmb. This is true for the existing __ktime_get_fast_ns() as we as the new latch_tee_find(). Should we look at introducing yet another seq primitive?