lkml.org 
[lkml]   [2010]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
DateMon, 1 Feb 2010 07:27:16 -0800 (PST)
FromLinus Torvalds <>
SubjectRe: [patch 2/3] scheduler: add full memory barriers upon task switch at runqueue lock/unlock


On Sun, 31 Jan 2010, Mathieu Desnoyers wrote:
>
> Adds no overhead on x86, because LOCK-prefixed atomic operations of the spin
> lock/unlock already imply a full memory barrier.

.. and as Nick pointed out, you're fundamentally incorrect on this.
unlock on x86 is no memory barrier at all, since the x86 memory ordering
rules are such that a regular store always has release consistency.

But more importantly, you don't even explain why the addded smp_mb()
helps.

Why does a smp_mb() at the lock/unlock even matter? Reading accesses by
the same CPU sure as hell do _not_ matter, so the whole concept seems
totally broken. There is no way in _hell_ that whatever unlocked thing
can ever write the variables protected by the lock, only read them. So a
full memory barrier makes zero sense to begin with.

So what are these magical memory barriers all about?

Linus


\
 
 \ /
  Last update: 2010-02-01 16:31    [from the cache]
©2003-2010