Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1764339AbXHORCA (ORCPT ); Wed, 15 Aug 2007 13:02:00 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1762436AbXHORBl (ORCPT ); Wed, 15 Aug 2007 13:01:41 -0400 Received: from pentafluge.infradead.org ([213.146.154.40]:60334 "EHLO pentafluge.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1763475AbXHORBj (ORCPT ); Wed, 15 Aug 2007 13:01:39 -0400 Date: Wed, 15 Aug 2007 22:43:37 +0530 (IST) From: Satyam Sharma X-X-Sender: satyam@enigma.security.iitk.ac.in To: "Paul E. McKenney" cc: Stefan Richter , Herbert Xu , Heiko Carstens , Chris Snook , clameter@sgi.com, Linux Kernel Mailing List , linux-arch@vger.kernel.org, Linus Torvalds , netdev@vger.kernel.org, Andrew Morton , ak@suse.de, davem@davemloft.net, schwidefsky@de.ibm.com, wensong@linux-vs.org, horms@verge.net.au, wjiang@resilience.com, cfriesen@nortel.com, zlynx@acm.org, rpjday@mindspring.com, jesper.juhl@gmail.com, segher@kernel.crashing.org Subject: Re: [PATCH 0/24] make atomic_read() behave consistently across all architectures In-Reply-To: <20070815162722.GD9645@linux.vnet.ibm.com> Message-ID: References: <46C2350A.1010807@redhat.com> <20070815081841.GA16551@osiris.boeblingen.de.ibm.com> <46C30540.2070603@s5r6.in-berlin.de> <20070815145207.GA23106@gondor.apana.org.au> <46C3253F.5090707@s5r6.in-berlin.de> <20070815162722.GD9645@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1343 Lines: 38 On Wed, 15 Aug 2007, Paul E. McKenney wrote: > On Wed, Aug 15, 2007 at 06:09:35PM +0200, Stefan Richter wrote: > > Herbert Xu wrote: > > > On Wed, Aug 15, 2007 at 08:05:38PM +0530, Satyam Sharma wrote: > > >>> I don't know if this here is affected: > > > > [...something like] > > b = atomic_read(a); > > for (i = 0; i < 4; i++) { > > msleep_interruptible(63); > > c = atomic_read(a); > > if (c != b) { > > b = c; > > i = 0; > > } > > } > > > > > Nope, we're calling schedule which is a rather heavy-weight > > > barrier. > > > > How does the compiler know that msleep() has got barrier()s? > > Because msleep_interruptible() is in a separate compilation unit, > the compiler has to assume that it might modify any arbitrary global. > In many cases, the compiler also has to assume that msleep_interruptible() > might call back into a function in the current compilation unit, thus > possibly modifying global static variables. Yup, I've just verified this with a testcase. So a call to any function outside of the current compilation unit acts as a compiler barrier. Cool. - 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/