diff options
author | Jan Beulich <jbeulich@novell.com> | 2008-08-17 00:25:05 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-08-20 11:15:47 -0700 |
commit | 139d09bb6ec8af8de216b0e8b04304d3f5f396bf (patch) | |
tree | 2cdd53a201effb5e6f20337d4f7ece7fb3a939ce | |
parent | 8351091278bee4ee706b1c08c54193914acc7d31 (diff) | |
download | linux-stable-139d09bb6ec8af8de216b0e8b04304d3f5f396bf.tar.gz linux-stable-139d09bb6ec8af8de216b0e8b04304d3f5f396bf.tar.bz2 linux-stable-139d09bb6ec8af8de216b0e8b04304d3f5f396bf.zip |
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 <jbeulich@novell.com>
Acked-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | include/asm-x86/spinlock.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/asm-x86/spinlock.h b/include/asm-x86/spinlock.h index 23804c1890ff..68d473c26be2 100644 --- a/include/asm-x86/spinlock.h +++ b/include/asm-x86/spinlock.h @@ -75,7 +75,7 @@ static inline int __raw_spin_is_contended(raw_spinlock_t *lock) { int tmp = *(volatile signed int *)(&(lock)->slock); - return (((tmp >> 8) & 0xff) - (tmp & 0xff)) > 1; + return (((tmp >> 8) - tmp) & 0xff) > 1; } static inline void __raw_spin_lock(raw_spinlock_t *lock) @@ -141,7 +141,7 @@ static inline int __raw_spin_is_contended(raw_spinlock_t *lock) { int tmp = *(volatile signed int *)(&(lock)->slock); - return (((tmp >> 16) & 0xffff) - (tmp & 0xffff)) > 1; + return (((tmp >> 16) - tmp) & 0xffff) > 1; } static inline void __raw_spin_lock(raw_spinlock_t *lock) |