AFAIK memory barriers are the architecture specific instructions which restricts the instruction execution in order as received, since otherwise CPU might change the order of execution of instructions for effective use of pipelines or instruction execution optimizations.<div>
<br></div><div>Although many times it is required that the instructions to be executed in particular order only in order to prevent the consistency of data and hence memory barriers are required.</div><div><br></div><div>
Regards,</div><div>Piyush</div><div> <div><br><div class="gmail_quote">2011/3/6 Михаил Кринкин <span dir="ltr">&lt;<a href="mailto:krinkin.m.u@gmail.com">krinkin.m.u@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<pre style="margin-left:0px;margin-top:0px;margin-bottom:0px;padding-top:0px;padding-bottom:0px;font-family:sans-serif">You can see linux/Documentation<span style="font-size:medium">/<span style="font-family:arial;font-size:small;white-space:normal">memory_barriers.txt about barriers in common</span></span></pre>

<pre style="margin-left:0px;margin-top:0px;margin-bottom:0px;padding-top:0px;padding-bottom:0px;font-family:sans-serif;font-size:medium"><span style="font-family:arial;font-size:small;white-space:normal"><br>
</span></pre><pre style="margin-left:0px;margin-top:0px;margin-bottom:0px;padding-top:0px;padding-bottom:0px"><font face="arial"><span style="white-space:normal">i think, that specific definition of __memory_barrier depend on architecture. What file did you found this definition in?</span></font></pre>

<pre style="margin-left:0px;margin-top:0px;margin-bottom:0px;padding-top:0px;padding-bottom:0px"><font face="arial"><span style="white-space:normal"><br>
</span></font></pre><pre style="margin-left:0px;margin-top:0px;margin-bottom:0px;padding-top:0px;padding-bottom:0px;font-family:sans-serif;font-size:medium"><span style="font-family:arial;font-size:small;white-space:normal"><br>
</span></pre><div class="gmail_quote">2011/3/6 loody <span dir="ltr">&lt;<a href="mailto:miloody@gmail.com" target="_blank">miloody@gmail.com</a>&gt;</span><div><div></div><div class="h5"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">hi all:<br>
I grep kernel source and found cpu_relax is defined as<br>
__memory_barrier(), which seems not defined in kernel source.<br>
At beginning I think it may be the gcc build-in functions, but I<br>
cannot find in the gcc document.<br>
Where and what is that used for?<br>
<font color="#888888"><br>
--<br>
Regards,<br>
miloody<br>
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</font></blockquote></div></div></div><br>
<br>_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
<br></blockquote></div><br></div></div>