Re: can somebody explain barrier() macro ?

From: Richard B. Johnson (
Date: Tue Feb 20 2001 - 15:17:39 EST

On Tue, 20 Feb 2001 wrote:

> Hi,
> barrier() is defined in kernel.h as follows :
> #define barrier() __asm__ __volatile__("": : :"memory")
> what does this mean ? is this like "nop" ?

It tells the compiler that memory was, or is about to be, modified.
Therefore, the complier must put back into memory anything it
was caching, and after the barrier, it must re-read anything it
uses from memory. It, itself, generates no code, but the compiler
will usually spew out some 'extra' instructions as a result of
this, so it isn't a "nop".

Dick Johnson

Penguin : Linux version 2.4.1 on an i686 machine (799.53 BogoMips).

"Memory is like gasoline. You use it up when you are running. Of
course you get it all back when you reboot..."; Actual explanation
obtained from the Micro$oft help desk.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Fri Feb 23 2001 - 21:00:23 EST