Re: [PATCH 8/7] net/netfilter/nf_conntrack_core: Remove another memory barrier

From: Peter Zijlstra
Date: Thu Sep 01 2016 - 12:41:42 EST


On Thu, Sep 01, 2016 at 04:30:39PM +0100, Will Deacon wrote:
> On Thu, Sep 01, 2016 at 05:27:52PM +0200, Manfred Spraul wrote:
> > Since spin_unlock_wait() is defined as equivalent to spin_lock();
> > spin_unlock(), the memory barrier before spin_unlock_wait() is
> > also not required.

Note that ACQUIRE+RELEASE isn't a barrier.

Both are semi-permeable and things can cross in the middle, like:


x = 1;
LOCK
UNLOCK
r = y;

can (validly) get re-ordered like:

LOCK
r = y;
x = 1;
UNLOCK

So if you want things ordered, as I think you do, I think the smp_mb()
is still needed.

RELEASE + ACQUIRE otoh, that is a load-store barrier (but not
transitive).