Re: [PATCH RFC] 'spinlock/rwlock fixes' V3 [1/1]

From: Peter Chubb <>
Date: 2005-01-20 19:59:53
>>>>> "Chris" == Chris Wedgwood <> writes:

Chris> On Wed, Jan 19, 2005 at 07:01:04PM -0800, Andrew Morton wrote:

Chris> It still isn't enough to rid of the rwlock_read_locked and
Chris> rwlock_write_locked usage in kernel/spinlock.c as those are
Chris> needed for the cpu_relax() calls so we have to decide on
Chris> suitable names still...  

I suggest reversing the sense of the macros, and having read_can_lock()
and write_can_lock()

	read_can_lock() --- a read_lock() would have succeeded
	write_can_lock() --- a write_lock() would have succeeded.

IA64 implementation:

#define read_can_lock(x)  (*(volatile int *)x >= 0)
#define write_can_lock(x) (*(volatile int *)x == 0)

Then use them as
where you want the old semantics.  The compiler ought to be smart
enough to optimise the boolean ops.

Dr Peter Chubb  peterc AT
The technical we do immediately,  the political takes *forever*

To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to
More majordomo info at
Received on Thu Jan 20 04:01:18 2005

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:34 EST