while ((old = cmpxchg(&v->counter, c, c c_op i)) != c) \ c = old; \ \ return c; \ } #else #include <linux/irqflags.h> @@ -88,6 +100,20 @@ static inline int atomic_##op##_return(int i, atomic_t *v) \ return ret; \ } #define ATOMIC_FETCH_OP(op, c_op) ...
fetch_orwith CBNZ to make a retry loop. Both make the same loop around ldxr / stxr (for mo_relaxed). It would be a slight improvement to be able to get arbitrary code into the body of that loop, instead of having todo{ stuff }while(!x.compare_exchange_weak(old, new, mo_relaxed)...
16B atomic store and RMW can both use lock cmpxchg16b the obvious way. This makes pure stores much more expensive than regular vector stores, especially if the cmpxchg16b has to retry multiple times, but atomic RMW is already expensive. The extra instructions to move vector data to...
while ((old = cmpxchg(&v->counter, c, c c_op i)) != c) \ c = old; \ \ return c; \ } #else #include <linux/irqflags.h> @@ -88,6 +100,20 @@ static inline int atomic_##op##_return(int i, atomic_t *v) \ return ret; \ } #define ATOMIC_FETCH_OP(op, c_op) ...