[PATCH] _raw_read_trylock bias

From: Hugh Dickins
Date: Mon Oct 04 2004 - 13:21:11 EST


The i386 and x86_64 _raw_read_trylocks in preempt-smp.patch
are too successful: atomic_read() returns a signed integer.

Signed-off-by: Hugh Dickins <hugh@xxxxxxxxxxx>

--- 2.6.9-rc3-mm2/include/asm-i386/spinlock.h 2004-10-04 12:00:14.000000000 +0100
+++ linux/include/asm-i386/spinlock.h 2004-10-04 18:50:32.752864600 +0100
@@ -235,7 +235,7 @@ static inline int _raw_read_trylock(rwlo
{
atomic_t *count = (atomic_t *)lock;
atomic_dec(count);
- if (atomic_read(count) < RW_LOCK_BIAS)
+ if (atomic_read(count) >= 0)
return 1;
atomic_inc(count);
return 0;
--- 2.6.9-rc3-mm2/include/asm-x86_64/spinlock.h 2004-10-04 12:00:15.000000000 +0100
+++ linux/include/asm-x86_64/spinlock.h 2004-10-04 18:50:32.752864600 +0100
@@ -236,7 +236,7 @@ static inline int _raw_read_trylock(rwlo
{
atomic_t *count = (atomic_t *)lock;
atomic_dec(count);
- if (atomic_read(count) < RW_LOCK_BIAS)
+ if (atomic_read(count) >= 0)
return 1;
atomic_inc(count);
return 0;

-
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/