Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761278AbXHIWZH (ORCPT ); Thu, 9 Aug 2007 18:25:07 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752945AbXHIWYx (ORCPT ); Thu, 9 Aug 2007 18:24:53 -0400 Received: from gate.crashing.org ([63.228.1.57]:39499 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753453AbXHIWYw (ORCPT ); Thu, 9 Aug 2007 18:24:52 -0400 In-Reply-To: <46BB74B9.4070702@nortel.com> References: <20070809142430.GA19817@shell.boston.redhat.com> <8f6bb8a9e4f2819a161d732bdb6c70c0@kernel.crashing.org> <46BB403D.10202@redhat.com> <0a08872e608cf5f7a3d9c0fc746a1051@kernel.crashing.org> <46BB74B9.4070702@nortel.com> Mime-Version: 1.0 (Apple Message framework v623) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <9452870655b1844283961f8e9e406464@kernel.crashing.org> Content-Transfer-Encoding: 7bit Cc: wjiang@resilience.com, rpjday@mindspring.com, wensong@linux-vs.org, heiko.carstens@de.ibm.com, linux-kernel@vger.kernel.org, ak@suse.de, netdev@vger.kernel.org, horms@verge.net.au, akpm@linux-foundation.org, linux-arch@vger.kernel.org, jesper.juhl@gmail.com, torvalds@linux-foundation.org, schwidefsky@de.ibm.com, davem@davemloft.net, zlynx@acm.org, Chris Snook From: Segher Boessenkool Subject: Re: [PATCH 24/24] document volatile atomic_read() behavior Date: Fri, 10 Aug 2007 00:23:47 +0200 To: "Chris Friesen" X-Mailer: Apple Mail (2.623) Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1037 Lines: 27 >> Anyway, what's the supposed advantage of *(volatile *) vs. using >> a real volatile object? That you can access that same object in >> a non-volatile way? > > That's my understanding. That way accesses where you don't care about > volatility may be optimised. But those accesses might be done non-atomically then (for example, if the compiler knows it only needs to write one byte, it might not bother writing the rest), so that's no good if you want to read the thing atomically too. > For instance, in cases where there are already other things > controlling visibility (as are needed for atomic increment, for > example) you don't need to make the access itself volatile. Hrm, you mean within a lock or similar? You'll get the same semantics as volatile anyway there. Segher - 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/