Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933829AbYCFP6n (ORCPT ); Thu, 6 Mar 2008 10:58:43 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758472AbYCFP6d (ORCPT ); Thu, 6 Mar 2008 10:58:33 -0500 Received: from rtr.ca ([76.10.145.34]:4108 "EHLO mail.rtr.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753352AbYCFP6b (ORCPT ); Thu, 6 Mar 2008 10:58:31 -0500 Message-ID: <47D014A6.9090300@rtr.ca> Date: Thu, 06 Mar 2008 10:58:30 -0500 From: Mark Lord Organization: Real-Time Remedies Inc. User-Agent: Thunderbird 2.0.0.12 (X11/20080213) MIME-Version: 1.0 To: Linus Torvalds Cc: Alan Stern , Alan Cox , Pavel Machek , "Paul E. McKenney" , Andrew Morton , Zdenek Kabelac , davem@davemloft.net, "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 References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1248 Lines: 41 Linus Torvalds wrote: > > On Mon, 3 Mar 2008, Alan Stern wrote: >> 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? > > Yes, we do depend on this. All the RCU stuff (and in general *anything* > that depends on memory ordering as opposed to full locking, and we have > quite a lot of it) is very fundamentally dependent on the fact that things > like pointers get read and written atomically. .. But also consider something like this: void store_task(void) { *the_task = current; } In this case, there is no guarantee that the assignment can be done atomically on all CPU types. Some RISC archs (eg. MIPS R2xxx) require an (interruptible) instruction pair to store values to a potentially unaligned address. This was a BIG issue on a different system that I once worked on. Cheers -- 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/