[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.0609081723350.7953-100000@iolanthe.rowland.org>
Date: Fri, 8 Sep 2006 17:26:01 -0400 (EDT)
From: Alan Stern <stern@...land.harvard.edu>
To: Oliver Neukum <oliver@...kum.org>
cc: paulmck@...ibm.com, David Howells <dhowells@...hat.com>,
Kernel development list <linux-kernel@...r.kernel.org>
Subject: Re: Uses for memory barriers
On Fri, 8 Sep 2006, Oliver Neukum wrote:
> It seems you are correct.
> Therefore the correct code on CPU 1 would be:
>
> y = -1;
> b = 1;
> //mb();
> //x = a;
> while (y < 0) relax();
>
> mb();
> x = a;
>
> assert(x==1 || y==1); //???
>
> And yes, it is confusing. I've been forced to change my mind twice.
Again you have misunderstood. The original code was _not_ incorrect. I
was asking: Given the code as stated, would the assertion ever fail?
The code _was_ correct for my purposes, namely, to illustrate a technical
point about the behavior of memory barriers.
Alan
-
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