Thread (8 messages) 8 messages, 5 authors, 2011-03-13

where is __memory_barrier in kernel ?

From: piyush moghe <hidden>
Date: 2011-03-08 06:38:46

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
[off-list ref]wrote:
On Sun, Mar 6, 2011 at 21:02, loody [off-list ref] wrote:
quoted
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 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help