locking/qspinlock: Clarify xchg_tail() ordering
authorPeter Zijlstra <peterz@infradead.org>
Wed, 8 Jun 2016 07:12:30 +0000 (09:12 +0200)
committerIngo Molnar <mingo@kernel.org>
Wed, 8 Jun 2016 12:44:00 +0000 (14:44 +0200)
commit8d53fa19041ae65c484d81d75179b4a577e6d8e4
tree87f60f848df339868a1dde68ec7ae3250229fefa
parentae0b5c2f0334f35d2b2effb13aa418bc1e2039b7
locking/qspinlock: Clarify xchg_tail() ordering

While going over the code I noticed that xchg_tail() is a RELEASE but
had no obvious pairing commented.

It pairs with a somewhat unique address dependency through
decode_tail().

So the store-release of xchg_tail() is paired by the address
dependency of the load of xchg_tail followed by the dereference from
the pointer computed from that load.

The @old -> @prev transformation itself is pure, and therefore does
not depend on external state, so that is immaterial wrt. ordering.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Pan Xinhui <xinhui.pan@linux.vnet.ibm.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Waiman Long <waiman.long@hpe.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/locking/qspinlock.c