Skip to contentSkip to conversation

memory_barrier

DISCUSSION Bart De Schuymer 2 participants 2 messages Apr 9, 2005

lore
Share & tools
lore
#0 lore raw

Hi,

Is there any reason why __memory_barrier() is still referenced in the kernel source?

grep -r memory_barrier gave the following back, which at first seems to suggest barrier() is defined using some phantom __memory_barrier(), quite deceiving...

include/linux/compiler-intel.h:#define barrier() __memory_barrier() include/linux/compiler.h:# define barrier() __memory_barrier() include/asm-m32r/system.h: * memory_barrier() for examples and URLs to more information.
include/asm-m32r/system.h: * memory_barrier();
include/asm-m32r/system.h: * memory_barrier();
include/asm-i386/system.h: * memory_barrier() for examples and URLs to more information.
include/asm-i386/system.h: * memory_barrier();
include/asm-i386/system.h: * memory_barrier();
include/asm-mips/system.h: * memory_barrier() for examples and URLs to more information.
include/asm-mips/system.h: * memory_barrier();
include/asm-mips/system.h: * memory_barrier();
include/asm-ia64/intel_intrin.h:void __memory_barrier(void);
include/asm-ia64/intel_intrin.h:#define ia64_barrier() __memory_barrier()

cheers,
Bart

#1 lore raw

Bart> Hi, Is there any reason why __memory_barrier() is still Bart> referenced in the kernel source?

Bart> grep -r memory_barrier gave the following back, which at Bart> first seems to suggest barrier() is defined using some Bart> phantom __memory_barrier(), quite deceiving...

Notice that it's used in <linux/compiler-intel.h> -- the Intel compiler has an intrinsic called __memory_barrier(). So the definition of barrier() using this intrinsic is entirely correct and appropriate.

- R.