[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20101208220640.GB4895@redhat.com>
Date: Wed, 8 Dec 2010 23:06:40 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
Cc: Vivek Goyal <vgoyal@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: blk-throttle: Correct the placement of smp_rmb()
On 12/08, Oleg Nesterov wrote:
>
> Unfortunately, I can't prove this. You can ask
> Paul McKenney if you want the authoritative answer.
Well. I think we should ask ;) This is interesting.
Paul could you please shed a light?
Suppose we have 2 variables, A = 0 and B = 0.
CPU0 does:
A = 1;
wmb();
B = 1;
CPU1 does:
B = 0;
mb();
if (A)
A = 2;
My understanding is: after that we can safely assume that
B == 1 || A == 2
IOW. Either CPU1 notices that A was changed, or CPU0 "wins"
and sets B = 1 "after" CPU1. But, it is not possible that
CPU1 clears B "after" it was set by CPU0 _and_ sees A == 0.
Is it true? I think it should be true, but can't prove. This
reminds me the old (and long) discussion about STORE-MB-LOAD.
Iirc, finally it was decided that
CPU0: CPU1:
A = 1; B = 1;
mb(); mb();
if (B) if (A)
printf("Yes"); printf("Yes");
should print "Yes" at least once. This looks very similar to
the the previous example.
Thanks,
Oleg.
--
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