atomic.h: Use __atomic_load_n() for acquire
PATCH 1/1 atomic.h: Use __atomic_load_n() for acquire
We can use __atomic_load_n() saving a store and load from the _val.
Signed-off-by Pranith Kumar <[email protected]>
--- include/qemu/atomic.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
include/qemu/atomic.h +1 -3
@@ -144,9 +144,7 @@#define atomic_load_acquire (ptr) \ ({ \ QEMU_BUILD_BUG_ON(sizeof(*ptr) > sizeof(void *)); \ - typeof_strip_qual(*ptr) _val; \ - __atomic_load(ptr, &_val, __ATOMIC_ACQUIRE); \ - _val; \ + __atomic_load_n(ptr, __ATOMIC_ACQUIRE); \ })#define atomic_store_release (ptr, i) do { \
Signature · 1 line
2.10.2
Quoted 13 lines · Pranith Kumar
We can use
__atomic_load_n()saving a store and load from the_val.Signed-off-by Pranith Kumar <[email protected]>--- include/qemu/atomic.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)include/qemu/atomic.h +0
-0
include/qemu/atomic.h line 150
Quoted 10 lines
include/qemu/atomic.h +1
-3@@ -144,9 +144,7 @@#define atomic_load_acquire (ptr) \ ({ \ QEMU_BUILD_BUG_ON(sizeof(*ptr) > sizeof(void *)); \ - typeof_strip_qual(*ptr) _val; \ - __atomic_load(ptr, &_val, __ATOMIC_ACQUIRE); \ - _val; \ + __atomic_load_n(ptr, __ATOMIC_ACQUIRE); \ })#define atomic_store_release (ptr, i) do { \
Can you do the same for atomic_rcu_read__nocheck (both implementations)?
Thanks,
Paolo
Quoted 3 lines · Paolo Bonzini
Can you do the same for
atomic_rcu_read__nocheck(both implementations)?
Sure, will send an updated patch.
Signature · 1 line
Pranith