Re: spin_unlock optimization(i386)

Andrea Arcangeli (andrea@suse.de)
Wed, 24 Nov 1999 23:43:51 +0100 (CET)


On Wed, 24 Nov 1999, Erich Boleyn wrote:

>What do you want the memory barrier for other than to prevent reads
>from crossing the unlock? (apologies if I missed this in an earlier

The spin_unlock is fine agreed. Thanks.

About the _read_ memory barrier (rmb()) it must also prevent _following_
reads to be reordered _before_ the barrier.

read 0x0
rmb(); /* lock on the bus, I was proposing to replace with a write (wrong!) */
read 0x20

The rmb() ensure the "read 0x20" will be executed _after_ "read 0x0".

If I understood well by this thread, a write in the middle of two reads
on IA32 only ensure that the 0x0 is read _before_ the write. But the read
0x20 can happen even before the write and before "read 0x0". This in turn
mean that rmb() can't be implemented with a write in the zero page...

Apologies for the wasted time. Now all is clear to me. Thank you.

Andrea

-
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/