lockref: use cmpxchg64 explicitly for lockless updates
authorWill Deacon <will.deacon@arm.com>
Thu, 19 Sep 2013 18:06:46 +0000 (19:06 +0100)
committerMaciej Wereski <m.wereski@partner.samsung.com>
Tue, 9 Jun 2015 09:30:57 +0000 (11:30 +0200)
commite0f8e433c26f45a7c72169b50b49c8da32d8b895
tree26125b0f9383957088e395f9b078320d0981d929
parent31ba4ff56a4940114078e230213bf007dc61a494
lockref: use cmpxchg64 explicitly for lockless updates

The cmpxchg() function tends not to support 64-bit arguments on 32-bit
architectures.  This could be either due to use of unsigned long
arguments (like on ARM) or lack of instruction support (cmpxchgq on
x86).  However, these architectures may implement a specific cmpxchg64()
function to provide 64-bit cmpxchg support instead.

Since the lockref code requires a 64-bit cmpxchg and relies on the
architecture selecting ARCH_USE_CMPXCHG_LOCKREF, move to using cmpxchg64
instead of cmpxchg and allow 32-bit architectures to make use of the
lockless lockref implementation.

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