<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello,<br>
I have been reading up on atomics and struggle to grasp when exactly
I need explicit memory barriers.<br>
<br>
While the documentation (Documentat/atomic_ops.txt), talks about
operations needing explicit barriers both sides, I assume this is
only half true.<br>
If I for instance only want to use an atomic as a flag to show that
some operation is complete I reckon that a barrier before is
sufficient.<br>
<br>
Furthermore I found the following lines:<br>
<pre><span class="lno"><a id="L288" href="http://users.sosdg.org/%7Eqiyong/lxr/source/Documentation/atomic_ops.txt#L288">288</a> </span><span class="code">If a caller requires memory barrier semantics around an atomic_t</span>
<span class="lno"><a id="L289" href="http://users.sosdg.org/%7Eqiyong/lxr/source/Documentation/atomic_ops.txt#L289">289</a> </span><span class="code">operation which does not return a value, a set of interfaces are</span>
<span class="lno"><a id="L290" href="http://users.sosdg.org/%7Eqiyong/lxr/source/Documentation/atomic_ops.txt#L290">290</a> </span><span class="code">defined which accomplish this:</span>
<span class="lno"><a id="L291" href="http://users.sosdg.org/%7Eqiyong/lxr/source/Documentation/atomic_ops.txt#L291">291</a> </span><span class="code"></span>
<span class="lno"><a id="L292" href="http://users.sosdg.org/%7Eqiyong/lxr/source/Documentation/atomic_ops.txt#L292">292</a> </span><span class="code">        void smp_mb__before_atomic(void);</span>
<span class="lno"><a id="L293" href="http://users.sosdg.org/%7Eqiyong/lxr/source/Documentation/atomic_ops.txt#L293">293</a> </span><span class="code">        void smp_mb__after_atomic(void);</span></pre>
note how it refers to "operation which does not return a value", why
can't I use these for atomic operations that do return a value?<br>
What should I use instead, normal barriers like mb?<br>
<br>
Please enlighten me<br>
Malte<br>
</body>
</html>