where is __memory_barrier in kernel ?
piyush moghe
pmkernel at gmail.com
Tue Mar 8 01:38:46 EST 2011
Yes what you are saying is also right, since in order to prevent the
ordering all the pending memory operations should have completed
hence as you mentioned processor stops and make sure all the memory
operations are completed.
On Tue, Mar 8, 2011 at 11:59 AM, Mulyadi Santosa
<mulyadi.santosa at gmail.com>wrote:
> On Sun, Mar 6, 2011 at 21:02, loody <miloody at gmail.com> 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 at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110308/701651ef/attachment.html
More information about the Kernelnewbies
mailing list