[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 3/3] rwlock: allow arch to override write_unlock() atomic



... (for consistency with read_unlock()), and default it to xchg(),
being generally cheaper than cmpxchg().

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/xen/common/spinlock.c
+++ b/xen/common/spinlock.c
@@ -438,10 +438,14 @@ int _write_trylock(rwlock_t *lock)
     return 1;
 }
 
-void _write_unlock(rwlock_t *lock)
+#ifndef _raw_write_unlock
+# define _raw_write_unlock(l) xchg(&(l)->lock, 0)
+#endif
+
+inline void _write_unlock(rwlock_t *lock)
 {
     preempt_enable();
-    if ( cmpxchg(&lock->lock, RW_WRITE_FLAG, 0) != RW_WRITE_FLAG )
+    if ( _raw_write_unlock(lock) != RW_WRITE_FLAG )
         BUG();
 }
 



Attachment: arch-write-unlock.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.