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

[Xen-devel] [PATCH] i386: simplify pte_read_atomic()



There's no need for a loop here: if the value to be compared against
and the value to be stored are equal, cmpxchg{,8b} act just like a
load anyway.

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

--- a/xen/include/asm-x86/x86_32/page.h
+++ b/xen/include/asm-x86/x86_32/page.h
@@ -84,11 +84,7 @@ extern unsigned int PAGE_HYPERVISOR_NOCA
 
 #endif
 
-#define pte_read_atomic(ptep) ({                              \
-    intpte_t __pte = *(ptep), __npte;                         \
-    while ( (__npte = cmpxchg(ptep, __pte, __pte)) != __pte ) \
-        __pte = __npte;                                       \
-    __pte; })
+#define pte_read_atomic(ptep) cmpxchg(ptep, 0, 0)
 #define pte_write_atomic(ptep, pte) do {                      \
     intpte_t __pte = *(ptep), __npte;                         \
     while ( (__npte = cmpxchg(ptep, __pte, (pte))) != __pte ) \



Attachment: i386-pte-read-atomic.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

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