On 26.04.2018 18:20, Peter Zijlstra wrote: > On Thu, Apr 26, 2018 at 04:52:39PM +0300, Kirill Tkhai wrote: >> In the patch I used the logic, that the below code: >> >> x = A; >> spin_lock(); >> spin_unlock(); >> spin_lock(); >> spin_unlock(); >> y = B; >> >> cannot reorder much than: >> >> spin_lock(); >> x = A; <- this can't become visible later, that spin_unlock() >> spin_unlock(); >> spin_lock(); >> y = B; <- this can't become visible earlier, than spin_lock() >> spin_unlock(); >> >> Is there a problem? > > The two stores will be ordered, but only at the strength of an > smp_wmb(). The above construct does not imply smp_mb(). The difference > is observable on real hardware (Power).
Ah, thanks. But hopefully, smp_rmb() should be enough here.