Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1186232
| From | Waiman Long <waiman.long@hp.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2 7/7] ARM: atomics: define our SMP atomics in terms of _relaxed operations |
| Date | 2015-07-16 22:50 +0200 |
| Message-ID | <pMYgp-SY-1@gated-at.bofh.it> (permalink) |
| References | <pMTqr-2pX-21@gated-at.bofh.it> <pMTqr-2pX-33@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 07/16/2015 11:32 AM, Will Deacon wrote:
> By defining our SMP atomics in terms of relaxed operations, we gain
> a small reduction in code size and have acquire/release/fence variants
> generated automatically by the core code.
>
> Signed-off-by: Will Deacon<will.deacon@arm.com>
> ---
> arch/arm/include/asm/atomic.h | 37 ++++++++++++++-------------------
> arch/arm/include/asm/cmpxchg.h | 47 +++++++-----------------------------------
> 2 files changed, 24 insertions(+), 60 deletions(-)
>
>
>
> -#define xchg(ptr, x) ({ \
> +#define xchg_relaxed(ptr, x) ({ \
> (__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), \
> sizeof(*(ptr))); \
> })
> @@ -117,6 +115,8 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size
> #error "SMP is not supported on this platform"
> #endif
>
> +#define xchg xchg_relaxed
Is that a typo? I think xchg() needs to be a full memory barrier.
Cheers,
Longman
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 7/7] ARM: atomics: define our SMP atomics in terms of _relaxed operations Will Deacon <will.deacon@arm.com> - 2015-07-16 17:40 +0200
Re: [PATCH v2 7/7] ARM: atomics: define our SMP atomics in terms of _relaxed operations Waiman Long <waiman.long@hp.com> - 2015-07-16 22:50 +0200
Re: [PATCH v2 7/7] ARM: atomics: define our SMP atomics in terms of _relaxed operations Peter Zijlstra <peterz@infradead.org> - 2015-07-16 23:10 +0200
Re: [PATCH v2 7/7] ARM: atomics: define our SMP atomics in terms of _relaxed operations Waiman Long <waiman.long@hp.com> - 2015-07-17 02:10 +0200
Re: [PATCH v2 7/7] ARM: atomics: define our SMP atomics in terms of _relaxed operations Will Deacon <will.deacon@arm.com> - 2015-07-17 11:40 +0200
csiph-web