Re: spin_unlock optimization(i386)

Linus Torvalds (torvalds@transmeta.com)
Thu, 25 Nov 1999 15:57:58 -0800 (PST)


On Fri, 26 Nov 1999, Manfred Spraul wrote:
>
> [Either my test program is completely buggy, or ]
>
> We definitively need the memory barrier during set_current_state():

Yes. I think that oxymorons explanation is the correct one: we do need the
serialization for "lock" operations, and we do need it to protect other
data.

The reason unlock can be done without serialization is just due to intel
breaking symmetry on re-ordering reads and writes: if you allow reads to
only pass "upwards", then that in itself is sufficient explanation for why
the simple unlock works.

And yes, Manfred, this is what you have claimed all along. You were right.

I still suspect that Intel doesn't really guarantee this behaviour in its
litterature, but on the other hand there is some safety in knowing that NT
depends on the behaviour and Intel cannot change it without completely
breaking NT...

So let's just have the memory barriers we already have, and just optimize
the unlock.

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/