[PATCH RFC] Avoid memory barrier in read_seqcount() through load acquire
Christoph Lameter (Ampere)
cl at gentwo.org
Tue Aug 13 12:41:11 PDT 2024
On Tue, 13 Aug 2024, Waiman Long wrote:
> Do we need a new ARCH flag? I believe barrier APIs like smp_load_acquire()
> will use the full barrier for those arch'es that don't define their own
> smp_load_acquire().
Well this is a load acquire instruction. The fallback of smp_load_aquire
is:
#define __smp_load_acquire(p) \
({ \
__unqual_scalar_typeof(*p) ___p1 = READ_ONCE(*p); \
compiletime_assert_atomic_type(*p); \
__smp_mb(); \
(typeof(*p))___p1; \
})
Looks like we have an acquire + barrier here.
> BTW, acquire/release can be considered memory barriers too. Maybe you are
> talking about preferring acquire/release barriers over read/write barriers.
> Right?
Load acquire is a single instruction load that does not require full
barrier semantics for the critical section but ensures that the value is
loaded before all following. Regular barriers do not have this singe load
that isolates the critical section and sequence all loads around them.
More information about the linux-arm-kernel
mailing list