Re: can somebody explain barrier() macro ?

Richard B. Johnson (root@chaos.analogic.com)
Tue, 20 Feb 2001 15:17:39 -0500 (EST)


On Tue, 20 Feb 2001 hiren_mehta@agilent.com 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".

Cheers,
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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/