Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756949AbYCCRLW (ORCPT ); Mon, 3 Mar 2008 12:11:22 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752086AbYCCRLP (ORCPT ); Mon, 3 Mar 2008 12:11:15 -0500 Received: from iolanthe.rowland.org ([192.131.102.54]:44955 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751319AbYCCRLO (ORCPT ); Mon, 3 Mar 2008 12:11:14 -0500 Date: Mon, 3 Mar 2008 12:11:12 -0500 (EST) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Alan Cox cc: Pavel Machek , "Paul E. McKenney" , Linus Torvalds , Andrew Morton , Zdenek Kabelac , , "Rafael J. Wysocki" , Pierre Ossman , Kernel development list , pm list Subject: Re: [patch] Re: using long instead of atomic_t when only set/read is required In-Reply-To: <20080303155330.39e45ad4@core> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1008 Lines: 34 On Mon, 3 Mar 2008, Alan Cox wrote: > > Atomicity of reads of write for pointers and integral types (other than > > long long) should be documented. > > NAK. > > Atomicity of reads or writes for pointers and integral types is NOT > guaranteed. Gcc doesn't believe in your guarantee. Miscommunication and lack of clarity. CPU reads and writes _are_ guaranteed to be atomic. What is not guaranteed is that the compiler will generate a single read or write instruction corresponding to a particular expression in C. Consider a routine like the following: static task_struct *the_task; void store_task(void) { the_task = current; } Is it possible to say whether readers examining "the_task" are guaranteed to see a coherent value? Alan Stern -- 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/