[patch 46/49] x86: fix spin_is_contended()

From: Greg KH
Date: Mon Aug 18 2008 - 15:48:47 EST


2.6.25-stable review patch. If anyone has any objections, please let us know.

------------------

From: Jan Beulich <jbeulich@xxxxxxxxxx>

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@xxxxxxxxxx>
Acked-by: Nick Piggin <npiggin@xxxxxxx>
Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

---
include/asm-x86/spinlock.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

--- a/include/asm-x86/spinlock.h
+++ b/include/asm-x86/spinlock.h
@@ -75,7 +75,7 @@ static inline int __raw_spin_is_contende
{
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_contende
{
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)

--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/