From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932642AbcERR0L (ORCPT ); Wed, 18 May 2016 13:26:11 -0400 Received: from e32.co.us.ibm.com ([32.97.110.150]:50175 "EHLO e32.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932113AbcERR0J (ORCPT ); Wed, 18 May 2016 13:26:09 -0400 X-IBM-Helo: d03dlp02.boulder.ibm.com X-IBM-MailFrom: paulmck@linux.vnet.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org Date: Wed, 18 May 2016 10:26:06 -0700 From: "Paul E. McKenney" To: Peter Zijlstra Cc: Peter Hurley , Waiman Long , Ingo Molnar , linux-kernel@vger.kernel.org, Davidlohr Bueso , Jason Low , Dave Chinner , Scott J Norton , Douglas Hatch , kcc@google.com, dvyukov@google.com, dhowells@redhat.com Subject: Re: [PATCH v2] locking/rwsem: Add reader-owned state to the owner field Message-ID: <20160518172606.GU3528@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com References: <5733AC64.6020306@hurleysoftware.com> <20160513150749.GT3192@twins.programming.kicks-ass.net> <573615AD.60300@hurleysoftware.com> <20160516110948.GM3193@twins.programming.kicks-ass.net> <20160516121719.GC3528@linux.vnet.ibm.com> <5739D686.302@hurleysoftware.com> <20160516175041.GR3193@twins.programming.kicks-ass.net> <573B6DC8.2030902@hurleysoftware.com> <20160517194607.GO3528@linux.vnet.ibm.com> <20160518110555.GE3193@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160518110555.GE3193@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: 16051817-0005-0000-0000-0000753DB05D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 18, 2016 at 01:05:55PM +0200, Peter Zijlstra wrote: > On Tue, May 17, 2016 at 12:46:07PM -0700, Paul E. McKenney wrote: > > Actually, if you show a case where this makes a visible system-wide > > difference, you could create a set of primitives for #1 below. Have > > a compiler version check, and if it is an old compiler, map them to > > READ_ONCE() and WRITE_ONCE(), otherwise as follows, though preferably > > with better names: > > > > #define READ_NOTEAR(x) __atomic_load_n(&(x), __ATOMIC_RELAXED) > > #define WRITE_NOTEAR(x, v) __atomic_store_n(&(x), (v), __ATOMIC_RELAXED) > > > > The ambiguity between "no tear" and "not ear" should help motivate a > > better choice of name. > > Alternatively, could we try and talk to our GCC friends to make sure GCC > doesn't tear loads/stores irrespective of what the C language spec > allows? Interestingly enough, they used to make that guarantee, but removed it when C11 showed up. Me, I would feel better explicitly telling the compiler what I needed. It is all too easy for bugs to slip in otherwise, especially when the gcc guys are adding exciting new optimizations. Thanx, Paul