2005-04-09 18:25:30

by Bart De Schuymer

[permalink] [raw]
Subject: memory_barrier

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



2005-04-09 20:41:45

by Roland Dreier

[permalink] [raw]
Subject: Re: memory_barrier

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.