Re: where is __memory_barrier in kernel ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Mar 6, 2011 at 21:02, loody <miloody@xxxxxxxxx> wrote:
> hi all:
> I grep kernel source and found cpu_relax is defined as
> __memory_barrier(), which seems not defined in kernel source.
> At beginning I think it may be the gcc build-in functions, but I
> cannot find in the gcc document.
> Where and what is that used for?

Hi..

are you sure it's memory barrier? I check the source in lxr.linux.no
(2.6.37.3) and cpu_relax is expanded as 'rep' and 'nop' asm
instruction

but speaking about __memory_barrier(), I find it in
http://lxr.linux.no/#linux+v2.6.37.3/include/linux/compiler-intel.h#L19...meaning...(at
least for me), it's a macro specificly defined in Intel C compiler
(not gcc which we usually uses).

IMHO, it does the same as barrier everywhere....processor stop a while
and it make sure any memory operation (especially write) has been
done....

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux