public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* write_unlock: replace clear_bit with byte store
@ 2005-04-28 20:32 Christoph Lameter
  2005-04-28 20:43 ` David Mosberger
                   ` (23 more replies)
  0 siblings, 24 replies; 25+ messages in thread
From: Christoph Lameter @ 2005-04-28 20:32 UTC (permalink / raw)
  To: linux-ia64

The rwlocks use IMHO too many semaphore operations.

write_lock uses a cmpxchg like the regular spin_lock but write_unlock uses
clear_bit which requires a load and then a loop over a cmpxchg. The
following patch makes write_unlock simply use a store to clear the highest
8 bits. We will then still have the lower 3 bytes (24 bits) left to count
the readers. I would expect the performance of write_lock and
write_unlock to be the same as regular spinlocks with this patch.

Signed-off-by: Christoph Lameter <clameter@sgi.com>

Index: linux-2.6.11/include/asm-ia64/spinlock.h
=================================--- linux-2.6.11.orig/include/asm-ia64/spinlock.h	2005-03-01 23:37:48.000000000 -0800
+++ linux-2.6.11/include/asm-ia64/spinlock.h	2005-04-28 13:15:38.000000000 -0700
@@ -201,8 +201,9 @@ do {										\

 #define _raw_write_unlock(x)								\
 ({											\
-	smp_mb__before_clear_bit();	/* need barrier before releasing lock... */	\
-	clear_bit(31, (x));								\
+	u8 *y = (u8 *)x;								\
+	smp_wmb();			/* need barrier before releasing lock... */	\
+	y[3] = 0;									\
 })

 #endif /*  _ASM_IA64_SPINLOCK_H */

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2005-04-29 16:01 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-28 20:32 write_unlock: replace clear_bit with byte store Christoph Lameter
2005-04-28 20:43 ` David Mosberger
2005-04-28 20:53 ` Christoph Lameter
2005-04-28 22:05 ` Christoph Lameter
2005-04-28 22:25 ` Zou, Nanhai
2005-04-28 22:51 ` Christoph Lameter
2005-04-28 23:55 ` Chen, Kenneth W
2005-04-29  0:21 ` Christoph Lameter
2005-04-29  0:28 ` Chen, Kenneth W
2005-04-29  0:50 ` Christoph Lameter
2005-04-29  1:04 ` Chen, Kenneth W
2005-04-29  1:48 ` Chen, Kenneth W
2005-04-29  7:09 ` David Mosberger
2005-04-29 11:37 ` David Mosberger
2005-04-29 15:19 ` Christoph Lameter
2005-04-29 15:20 ` Christoph Lameter
2005-04-29 15:24 ` David Mosberger
2005-04-29 15:28 ` David Mosberger
2005-04-29 15:30 ` Christoph Lameter
2005-04-29 15:38 ` David Mosberger
2005-04-29 15:46 ` Christoph Lameter
2005-04-29 15:48 ` David Mosberger
2005-04-29 15:51 ` Christoph Hellwig
2005-04-29 15:55 ` Christoph Lameter
2005-04-29 16:01 ` David Mosberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox