diff options
author | Will Deacon <will.deacon@arm.com> | 2013-10-09 15:54:27 +0100 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2013-10-24 15:46:34 +0100 |
commit | 5686b06cea34e31ec0a549d9b5ac00776e8e8d6d (patch) | |
tree | 69f5fa9d9ccc89232bea8c1e1337a4217751ba3d /arch/arm64/include | |
parent | 52ea2a560a9dba57fe5fd6b4726b1089751accf2 (diff) |
arm64: lockref: add support for lockless lockrefs using cmpxchg
Our spinlocks are only 32-bit (2x16-bit tickets) and our cmpxchg can
deal with 8-bytes (as one would hope!).
This patch wires up the cmpxchg-based lockless lockref implementation
for arm64.
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/include')
-rw-r--r-- | arch/arm64/include/asm/spinlock.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/arch/arm64/include/asm/spinlock.h b/arch/arm64/include/asm/spinlock.h index 525dd535443..3d5cf064d7a 100644 --- a/arch/arm64/include/asm/spinlock.h +++ b/arch/arm64/include/asm/spinlock.h @@ -92,10 +92,14 @@ static inline void arch_spin_unlock(arch_spinlock_t *lock) : "memory"); } +static inline int arch_spin_value_unlocked(arch_spinlock_t lock) +{ + return lock.owner == lock.next; +} + static inline int arch_spin_is_locked(arch_spinlock_t *lock) { - arch_spinlock_t lockval = ACCESS_ONCE(*lock); - return lockval.owner != lockval.next; + return !arch_spin_value_unlocked(ACCESS_ONCE(*lock)); } static inline int arch_spin_is_contended(arch_spinlock_t *lock) |