[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150611073128.GQ19282@twins.programming.kicks-ass.net>
Date: Thu, 11 Jun 2015 09:31:28 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Kirill Tkhai <ktkhai@...n.com>, umgwanakikbuti@...il.com,
mingo@...e.hu, ktkhai@...allels.com, rostedt@...dmis.org,
tglx@...utronix.de, juri.lelli@...il.com, pang.xunlei@...aro.org,
wanpeng.li@...ux.intel.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 08/14] hrtimer: Allow hrtimer::function() to free the
timer
On Wed, Jun 10, 2015 at 06:04:44PM +0200, Oleg Nesterov wrote:
> If we rely on the "locking" semantics of seqcount_t, this doesn't really
> differ from
>
> spinlock_t LOCK;
> bool X = true, Y = false;
>
> void read(void)
> {
> bool x, y;
>
> spin_lock(LOCK);
> x = X; y = Y;
> spin_unlock(LOCK);
>
> BUG_ON(!x && !y);
> }
>
> void write(void)
> {
> Y = true;
>
> spin_lock(LOCK);
> spin_unlock(LOCK);
>
> X = false;
> }
So when I first saw that I went, wait what?
Because I looked at it like:
Y = true;
ACQUIRE
RELEASE
X = false;
And we both know that is not ordered at all.
But its the actual lock semantics that make it work, we cannot acquire
until the other completes, at which time the acquire matches its
release and things end up ordered again.
And its exactly that part we lost in our transformation C yesterday.
In any case, breakfast time, will go do the patches shortly.
--
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