Skip to content

Commit

Permalink
ARC: cmpxchg/xchg: implement relaxed variants (LLSC config only)
Browse files Browse the repository at this point in the history
It only makes sense to do this for the LLSC config

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Vineet Gupta <vgupta@kernel.org>
  • Loading branch information
Vineet Gupta committed Aug 24, 2021
1 parent e188f33 commit ddc348c
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions arch/arc/include/asm/cmpxchg.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
_prev; \
})

#define arch_cmpxchg(ptr, old, new) \
#define arch_cmpxchg_relaxed(ptr, old, new) \
({ \
__typeof__(ptr) _p_ = (ptr); \
__typeof__(*(ptr)) _o_ = (old); \
Expand All @@ -47,12 +47,7 @@
\
switch(sizeof((_p_))) { \
case 4: \
/* \
* Explicit full memory barrier needed before/after \
*/ \
smp_mb(); \
_prev_ = __cmpxchg(_p_, _o_, _n_); \
smp_mb(); \
break; \
default: \
BUILD_BUG(); \
Expand Down Expand Up @@ -108,16 +103,14 @@
_val_; /* get old value */ \
})

#define arch_xchg(ptr, val) \
#define arch_xchg_relaxed(ptr, val) \
({ \
__typeof__(ptr) _p_ = (ptr); \
__typeof__(*(ptr)) _val_ = (val); \
\
switch(sizeof(*(_p_))) { \
case 4: \
smp_mb(); \
_val_ = __xchg(_p_, _val_); \
smp_mb(); \
break; \
default: \
BUILD_BUG(); \
Expand Down

0 comments on commit ddc348c

Please sign in to comment.