From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752695AbcERLGJ (ORCPT ); Wed, 18 May 2016 07:06:09 -0400 Received: from merlin.infradead.org ([205.233.59.134]:37902 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750795AbcERLGH (ORCPT ); Wed, 18 May 2016 07:06:07 -0400 Date: Wed, 18 May 2016 13:05:55 +0200 From: Peter Zijlstra To: "Paul E. McKenney" 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: <20160518110555.GE3193@twins.programming.kicks-ass.net> References: <1462580424-40333-1-git-send-email-Waiman.Long@hpe.com> <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160517194607.GO3528@linux.vnet.ibm.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 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?