[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] atomic.h: Use __atomic_load_n() for acquire
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH] atomic.h: Use __atomic_load_n() for acquire |
Date: |
Tue, 1 Nov 2016 15:44:18 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 |
On 01/11/2016 15:33, Pranith Kumar wrote:
> We can use __atomic_load_n() saving a store and load from the _val.
>
> Signed-off-by: Pranith Kumar <address@hidden>
> ---
> include/qemu/atomic.h | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h
> index 878fa07..6775603 100644
> --- a/include/qemu/atomic.h
> +++ b/include/qemu/atomic.h
> @@ -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