Memory barriers for PPC
aph at redhat.com
Tue Jan 27 02:52:21 PST 2009
Gary Benson wrote:
> Andrew Haley wrote:
>> +#ifdef __PPC
> Can you make this "#ifdef PPC"?
>> +#define READ_MEM_BARRIER __asm __volatile ("":::"memory")
>> +#define WRITE_MEM_BARRIER __asm __volatile ("":::"memory")
> What's the difference between this and __sync_synchronize()?
This one is just a compiler memory barrier: it stops the compiler from
re-ordering reads or writes. It doesn't generate any actual code.
__sync_synchronize() is much more heavyweight: it generates a full
memory barrier across all processors in an SMP system.
More information about the distro-pkg-dev