Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755579AbaBUWht (ORCPT ); Fri, 21 Feb 2014 17:37:49 -0500 Received: from e33.co.us.ibm.com ([32.97.110.151]:36091 "EHLO e33.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753890AbaBUWhr (ORCPT ); Fri, 21 Feb 2014 17:37:47 -0500 Date: Fri, 21 Feb 2014 14:37:41 -0800 From: "Paul E. McKenney" To: "Joseph S. Myers" Cc: Michael Matz , Linus Torvalds , Torvald Riegel , Will Deacon , Peter Zijlstra , Ramana Radhakrishnan , David Howells , "linux-arch@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "akpm@linux-foundation.org" , "mingo@kernel.org" , "gcc@gcc.gnu.org" Subject: Re: [RFC][PATCH 0/5] arch: atomic rework Message-ID: <20140221223741.GO4250@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com References: <20140220181116.GT4250@linux.vnet.ibm.com> <20140220185608.GX4250@linux.vnet.ibm.com> <20140220221027.GC4250@linux.vnet.ibm.com> <20140221191318.GK4250@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14022122-0928-0000-0000-000006B10351 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 21, 2014 at 10:10:54PM +0000, Joseph S. Myers wrote: > On Fri, 21 Feb 2014, Paul E. McKenney wrote: > > > This needs to be as follows: > > > > [[carries_dependency]] int getzero(int i [[carries_dependency]]) > > { > > return i - i; > > } > > > > Otherwise dependencies won't get carried through it. > > C11 doesn't have attributes at all (and no specification regarding calls > and dependencies that I can see). And the way I read the C++11 > specification of carries_dependency is that specifying carries_dependency > is purely about increasing optimization of the caller: that if it isn't > specified, then the caller doesn't know what dependencies might be > carried. "Note: The carries_dependency attribute does not change the > meaning of the program, but may result in generation of more efficient > code. - end note". Good point -- I am so used to them being in gcc that I missed that. In which case, it seems to me that straight C11 is within its rights to emit a memory barrier just before control passes into a function that either it can't see or that it chose to apply dependency-breaking optimizations to. Thanx, Paul -- 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/