[PATCH 2/2] server: Relax memory order constraints in atomic_store_* functions.

Jinoh Kang jinoh.kang.kr at gmail.com
Thu Feb 10 11:19:50 CST 2022


We only require stores to not be reordered with other stores, so the
release semantics (load+store, store+store) would be enough.
Note that sequentially consistent memory accesses usually involve
an expensive memory barrier on most architectures.

Signed-off-by: Jinoh Kang <jinoh.kang.kr at gmail.com>
---
 server/fd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/server/fd.c b/server/fd.c
index 5865db89c33..ad010d4b4ea 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -393,7 +393,7 @@ static void atomic_store_ulong(volatile ULONG *ptr, ULONG value)
 #if defined(__i386__) || defined(__x86_64__)
     *ptr = value;
 #else
-    __atomic_store_n(ptr, value, __ATOMIC_SEQ_CST);
+    __atomic_store_n(ptr, value, __ATOMIC_RELEASE);
 #endif
 }
 
@@ -406,7 +406,7 @@ static void atomic_store_long(volatile LONG *ptr, LONG value)
 #if defined(__i386__) || defined(__x86_64__)
     *ptr = value;
 #else
-    __atomic_store_n(ptr, value, __ATOMIC_SEQ_CST);
+    __atomic_store_n(ptr, value, __ATOMIC_RELEASE);
 #endif
 }
 
-- 
2.34.1




More information about the wine-devel mailing list