lockref: allow relaxed cmpxchg64 variant for lockless updates
authorWill Deacon <will.deacon@arm.com>
Thu, 26 Sep 2013 16:27:00 +0000 (17:27 +0100)
committerMaciej Wereski <m.wereski@partner.samsung.com>
Tue, 9 Jun 2015 09:30:57 +0000 (11:30 +0200)
commit3232067a030a1a7e7a7b308d0a0f388b998023f7
treeb180cdee9169c68adca18f4343f89ae34e98407b
parente0f8e433c26f45a7c72169b50b49c8da32d8b895
lockref: allow relaxed cmpxchg64 variant for lockless updates

The 64-bit cmpxchg operation on the lockref is ordered by virtue of
hazarding between the cmpxchg operation and the reference count
manipulation. On weakly ordered memory architectures (such as ARM), it
can be of great benefit to omit the barrier instructions where they are
not needed.

This patch moves the lockless lockref code over to a cmpxchg64_relaxed
operation, which doesn't provide barrier semantics. If the operation
isn't defined, we simply #define it as the usual 64-bit cmpxchg macro.

Cc: Waiman Long <Waiman.Long@hp.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
lib/lockref.c