lkml.org 
[lkml]   [2008]   [Aug]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] x86: fix spin_is_contended()
On Mon, Aug 04, 2008 at 02:38:54PM +0100, Jan Beulich wrote:
> The masked difference is what needs to be compared against 1, rather
> than the difference of masked values (which can be negative).

Dang, thanks.

>
> Signed-off-by: Jan Beulich <jbeulich@novell.com>
> Cc: Nick Piggin <npiggin@suse.de>
>
> ---
> include/asm-x86/spinlock.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> --- linux-2.6.27-rc1/include/asm-x86/spinlock.h 2008-07-31 17:08:34.000000000 +0200
> +++ 2.6.27-rc1-x86-spin-is-contended/include/asm-x86/spinlock.h 2008-08-04 11:09:33.000000000 +0200
> @@ -65,7 +65,7 @@ static inline int __ticket_spin_is_conte
> {
> 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_conte
> {
> 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)
>
>


\
 
 \ /
  Last update: 2008-08-05 04:11    [W:0.024 / U:0.884 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site