Re: tutorial question: where mb() is needed?

Jamie Lokier (lkd@tantalophile.demon.co.uk)
Mon, 11 Jan 1999 11:23:32 +0000


On Sat, Jan 09, 1999 at 06:25:32AM +0000, Linus Torvalds wrote:
> No. The spinlocks themselves contain the required SMP memory
> synchronization points internally: otherwise they wouldn't be very
> useful as locking primitives. For example, on intel any locked memory
> reference (and the spinlocks do them) will act as a memory barrier, and
> that's why you don't see any extra code in asm-i386/spinlocks.h - on
> other architectures the spinlocks do other things to get the same goal.

Linus,

While the asm does force a processor-level barrier, the asm constraints
don't force GCC to keep memory references in the right order around the
barrier. I'm not sure if such a constraint is generally required. Can
you comment on this?

-- Jamie

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