[PATCH v2] mm: Pair atomic_set_release() with _read_acquire()
Linus Walleij
linus.walleij at linaro.org
Mon Oct 21 06:04:49 PDT 2024
On Mon, Oct 21, 2024 at 1:26 PM Linus Walleij <linus.walleij at linaro.org> wrote:
> The code for syncing vmalloc memory PGD pointers is using
> atomic_read() in pair with atomic_set_release() but the
> proper pairing is atomic_read_acquire() paired with
> atomic_set_release().
>
> This is done to clearly instruct the compiler to not
> reorder the memcpy() or similar calls inside the section
> so that we do not observe changes to init_mm. memcpy()
> calls should be identified by the compiler as having
> unpredictable side effects, but let's try to be on the
> safe side.
>
> Fixes: d31e23aff011 ("ARM: mm: make vmalloc_seq handling SMP safe")
> Suggested-by: Mark Rutland <mark.rutland at arm.com>
> Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
> ---
> This patch was done on top of Melon Liu's patch:
> https://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=9427/1
It turns out this patch does not build without KASAN enabled,
so it will need to be dropped.
I incorporated a line of Melon's semantics and included this patch into my
recent series and resent.
Yours,
Linus Walleij
More information about the linux-arm-kernel
mailing list