Commit a6582aa4 authored by Jan Beulich's avatar Jan Beulich Committed by Greg Kroah-Hartman

x86: fix spin_is_contended()

commit 7bc069c6 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: default avatarJan Beulich <jbeulich@novell.com>
Acked-by: default avatarNick Piggin <npiggin@suse.de>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent f04a00a3
...@@ -65,7 +65,7 @@ static inline int __raw_spin_is_contended(raw_spinlock_t *lock) ...@@ -65,7 +65,7 @@ static inline int __raw_spin_is_contended(raw_spinlock_t *lock)
{ {
int tmp = ACCESS_ONCE(lock->slock); 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) 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) ...@@ -129,7 +129,7 @@ static inline int __raw_spin_is_contended(raw_spinlock_t *lock)
{ {
int tmp = ACCESS_ONCE(lock->slock); 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) static __always_inline void __raw_spin_lock(raw_spinlock_t *lock)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment