diff options
author | Jan Beulich <jbeulich@novell.com> | 2008-08-04 09:38:54 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-08-15 10:26:51 -0400 |
commit | 7bc069c6bc4ede519a7116be1b9e149a1dbf787a (patch) | |
tree | 6f3506469c33869126df962b743c2899efe1ec00 /include/asm-x86 | |
parent | 8bb851900f5d0a79d3fddac808cc670d9894ef67 (diff) |
x86: fix spin_is_contended()
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>
Cc: <stable@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/asm-x86')
-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 4f9a9861799a..e39c790dbfd2 100644 --- a/include/asm-x86/spinlock.h +++ b/include/asm-x86/spinlock.h | |||
@@ -65,7 +65,7 @@ static inline int __ticket_spin_is_contended(raw_spinlock_t *lock) | |||
65 | { | 65 | { |
66 | int tmp = ACCESS_ONCE(lock->slock); | 66 | int tmp = ACCESS_ONCE(lock->slock); |
67 | 67 | ||
68 | return (((tmp >> 8) & 0xff) - (tmp & 0xff)) > 1; | 68 | return (((tmp >> 8) - tmp) & 0xff) > 1; |
69 | } | 69 | } |
70 | 70 | ||
71 | static __always_inline void __ticket_spin_lock(raw_spinlock_t *lock) | 71 | static __always_inline void __ticket_spin_lock(raw_spinlock_t *lock) |
@@ -127,7 +127,7 @@ static inline int __ticket_spin_is_contended(raw_spinlock_t *lock) | |||
127 | { | 127 | { |
128 | int tmp = ACCESS_ONCE(lock->slock); | 128 | int tmp = ACCESS_ONCE(lock->slock); |
129 | 129 | ||
130 | return (((tmp >> 16) & 0xffff) - (tmp & 0xffff)) > 1; | 130 | return (((tmp >> 16) - tmp) & 0xffff) > 1; |
131 | } | 131 | } |
132 | 132 | ||
133 | static __always_inline void __ticket_spin_lock(raw_spinlock_t *lock) | 133 | static __always_inline void __ticket_spin_lock(raw_spinlock_t *lock) |