[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 3 Mar 2008 12:11:12 -0500 (EST)
From: Alan Stern <stern@...land.harvard.edu>
To: Alan Cox <alan@...rguk.ukuu.org.uk>
cc: Pavel Machek <pavel@....cz>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...l.org>,
Zdenek Kabelac <zdenek.kabelac@...il.com>,
<davem@...emloft.net>, "Rafael J. Wysocki" <rjw@...k.pl>,
Pierre Ossman <drzeus-mmc@...eus.cx>,
Kernel development list <linux-kernel@...r.kernel.org>,
pm list <linux-pm@...ts.linux-foundation.org>
Subject: Re: [patch] Re: using long instead of atomic_t when only set/read
is required
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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists