diff options
author | Jeremy Fitzhardinge <jeremy@goop.org> | 2011-09-28 11:49:28 -0700 |
---|---|---|
committer | Jeremy Fitzhardinge <jeremy@goop.org> | 2011-11-25 10:42:59 -0800 |
commit | 3d94ae0c70a71a9824479366775e2c7679a57d94 (patch) | |
tree | 041c1013f123fb3177bed6b70375fdc4f6c0ddff /arch/x86/include/asm/spinlock.h | |
parent | 4a7f340c6a75ec5fca23d9c80a59f3f28cc4a61e (diff) | |
download | lwn-3d94ae0c70a71a9824479366775e2c7679a57d94.tar.gz lwn-3d94ae0c70a71a9824479366775e2c7679a57d94.zip |
x86/cmpxchg: add a locked add() helper
Mostly to remove some conditional code in spinlock.h.
Signed-off-by: Jeremy Fitzhardinge <jeremy@goop.org>
Diffstat (limited to 'arch/x86/include/asm/spinlock.h')
-rw-r--r-- | arch/x86/include/asm/spinlock.h | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/arch/x86/include/asm/spinlock.h b/arch/x86/include/asm/spinlock.h index 972c260919a3..a82c2bf504b6 100644 --- a/arch/x86/include/asm/spinlock.h +++ b/arch/x86/include/asm/spinlock.h @@ -79,23 +79,10 @@ static __always_inline int __ticket_spin_trylock(arch_spinlock_t *lock) return cmpxchg(&lock->head_tail, old.head_tail, new.head_tail) == old.head_tail; } -#if (NR_CPUS < 256) static __always_inline void __ticket_spin_unlock(arch_spinlock_t *lock) { - asm volatile(UNLOCK_LOCK_PREFIX "incb %0" - : "+m" (lock->head_tail) - : - : "memory", "cc"); + __add(&lock->tickets.head, 1, UNLOCK_LOCK_PREFIX); } -#else -static __always_inline void __ticket_spin_unlock(arch_spinlock_t *lock) -{ - asm volatile(UNLOCK_LOCK_PREFIX "incw %0" - : "+m" (lock->head_tail) - : - : "memory", "cc"); -} -#endif static inline int __ticket_spin_is_locked(arch_spinlock_t *lock) { |