[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <E1Ovt6F-0005CS-RU@pomaz-ex.szeredi.hu>
Date: Wed, 15 Sep 2010 16:36:39 +0200
From: Miklos Szeredi <miklos@...redi.hu>
To: dhowells@...hat.com
CC: linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org
Subject: memory barrier question
Hi,
I'm trying to understand memory barriers but not quite succeeding.
Consider the following example:
Start:
p = NULL;
x = 0;
CPU1:
atomic_inc(&x);
p = &x;
CPU2:
if (p)
z = atomic_read(p);
Is it possible to end up with z == 0? What if there's a lock/unlock
before setting "p"? What if there's a write barrier before setting
"p"?
Thanks,
Miklos
--
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