From: Jan Beulich Date: Sun, 17 Aug 2008 00:25:05 +0000 (+0000) Subject: x86: fix spin_is_contended() X-Git-Tag: v2.6.26.3~9 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=a6582aa43703213e727161911938db89c511aa57;p=karo-tx-linux.git x86: fix spin_is_contended() commit 7bc069c6bc4ede519a7116be1b9e149a1dbf787a upstream The masked difference is what needs to be compared against 1, rather than the difference of masked values (which can be negative). Signed-off-by: Jan Beulich Acked-by: Nick Piggin Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- diff --git a/include/asm-x86/spinlock.h b/include/asm-x86/spinlock.h index 21e89bf92f1c..bf2a3d2dfa62 100644 --- a/include/asm-x86/spinlock.h +++ b/include/asm-x86/spinlock.h @@ -65,7 +65,7 @@ static inline int __raw_spin_is_contended(raw_spinlock_t *lock) { int tmp = ACCESS_ONCE(lock->slock); - return (((tmp >> 8) & 0xff) - (tmp & 0xff)) > 1; + return (((tmp >> 8) - tmp) & 0xff) > 1; } static __always_inline void __raw_spin_lock(raw_spinlock_t *lock) @@ -129,7 +129,7 @@ static inline int __raw_spin_is_contended(raw_spinlock_t *lock) { int tmp = ACCESS_ONCE(lock->slock); - return (((tmp >> 16) & 0xffff) - (tmp & 0xffff)) > 1; + return (((tmp >> 16) - tmp) & 0xffff) > 1; } static __always_inline void __raw_spin_lock(raw_spinlock_t *lock)