]> err.no Git - linux-2.6/commitdiff
x86: fix spin_is_contended()
authorJan Beulich <jbeulich@novell.com>
Mon, 4 Aug 2008 13:38:54 +0000 (14:38 +0100)
committerIngo Molnar <mingo@elte.hu>
Fri, 15 Aug 2008 14:26:51 +0000 (16:26 +0200)
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>
include/asm-x86/spinlock.h

index 4f9a9861799ac648d406856a8a5ed1881e678a25..e39c790dbfd2be789d812a6cdd89efc3d39cb5ec 100644 (file)
@@ -65,7 +65,7 @@ static inline int __ticket_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 __ticket_spin_lock(raw_spinlock_t *lock)
@@ -127,7 +127,7 @@ static inline int __ticket_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 __ticket_spin_lock(raw_spinlock_t *lock)