Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752032AbbDPTlZ (ORCPT ); Thu, 16 Apr 2015 15:41:25 -0400 Received: from e39.co.us.ibm.com ([32.97.110.160]:53749 "EHLO e39.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750715AbbDPTlR (ORCPT ); Thu, 16 Apr 2015 15:41:17 -0400 Date: Thu, 16 Apr 2015 12:41:11 -0700 From: "Paul E. McKenney" To: Peter Zijlstra Cc: Ingo Molnar , Steven Rostedt , Mel Gorman , Rik van Riel , Jason Low , Linus Torvalds , Thomas Gleixner , linux-kernel@vger.kernel.org, Andrew Morton , Oleg Nesterov , Mike Galbraith , Frederic Weisbecker , Mel Gorman , Preeti U Murthy , hideaki.kimura@hp.com, Aswin Chandramouleeswaran , Scott J Norton Subject: Re: [PATCH 1/3] sched, timer: Remove usages of ACCESS_ONCE in the scheduler Message-ID: <20150416194111.GF23685@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com References: <1429052986-9420-2-git-send-email-jason.low2@hp.com> <20150414195906.3adc89d9@gandalf.local.home> <1429063953.7039.88.camel@j-VirtualBox> <20150414224059.061ec5bf@grimm.local.home> <20150415074601.GC13449@gmail.com> <20150416165224.GD12676@worktop.ger.corp.intel.com> <20150416180227.GB17401@gmail.com> <20150416181535.GA23123@twins.programming.kicks-ass.net> <20150416182426.GA17852@gmail.com> <20150416190208.GD23123@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150416190208.GD23123@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: 15041619-0033-0000-0000-00000444BA34 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1986 Lines: 54 On Thu, Apr 16, 2015 at 09:02:08PM +0200, Peter Zijlstra wrote: > On Thu, Apr 16, 2015 at 08:24:27PM +0200, Ingo Molnar wrote: > > Yes ... but that still leaves this weird feeling that it's really > > still a bit wrong because it's not proper parallel code, we just > > reduced the probability of the remaining races radically. And it's not > > like GCC (or any compiler) does load tearing or even store tearing > > under normal -O2 for such code patterns, right? > > I think Paul once caught GCC doing something silly, but typically no. > The re-loads however have been frequently observed. Too true! Some architectures do split stores of constants. For example, given an architecture with a store-immediate instruction with (say) a four-bit immediate field, gcc can compile this: x = 0x00020008; to something like: st $2, (x+2) st $8, (x) And gcc was doing this even though the store to x had volatile semantics, a bug which has thankfully since been fixed. But then again, I am paranoid. So I would not put it past gcc to think to itself "Hmmm... I just loaded x a few instructions back, and only clobbered the low-order byte. So I will just reload that byte into low-order byte of the register containing the remnants of the previous load." No, I have never seen gcc do that, but a C compiler could do that and still claim to be complying with the standard. :-/ Thanx, Paul > > > And its not like they really cost anything. > > > > That's true. > > > > Would it make sense to add a few comments to the seq field definition > > site(s), about how it's supposed to be accessed - or to the > > READ_ONCE()/WRITE_ONCE() sites, to keep people from wondering? > > For sure, can do a comment no problem. > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/