Re: [PATCH v3 2/8] lib/vsprintf: Use acquire/release for ptr_key publication
From: Petr Mladek
Date: Fri Sep 04 2026 - 10:02:45 EST
On Wed 2026-09-02 15:47:59, Jinjie Ruan wrote:
> Replace the smp_wmb() + WRITE_ONCE() and READ_ONCE() + smp_rmb() barrier
> pair with smp_store_release()/smp_load_acquire() on filled_random_ptr_key.
>
> This expresses the publish/subscribe pattern more clearly and allows
> architectures with native acquire/release instructions (e.g. arm64's
> STLR/LDAR) to avoid the cost of full one-way barriers (DMB ISHST/ISHLD).
>
> No functional change intended.
>
> Cc: Petr Mladek <pmladek@xxxxxxxx>
> Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
> Cc: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> Cc: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx>
> Cc: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Assisted-by: DeepSeek:DeepSeek-V3
> Signed-off-by: Jinjie Ruan <ruanjinjie@xxxxxxxxxx>
Just for record.
The conversion looks correct from the barrier guarantees POV.
I am just not 100% sure about that the performance on different
architectures. I asked this question as a reply on the cover
letter, see https://lore.kernel.org/all/apq5iLOF8lAQ_ZVU@xxxxxxxxxxxxxxx/
Anyway, vsprintf() is not a hot path. So, we do not need to take
care of the performance effect here. Feel free to use:
Reviewed-by: Petr Mladek <pmladek@xxxxxxxx>
I am going wait how the discussion about the performance goes.
If it does not block this patchset then I could queue this
particular patch via printk tree.
Best Regards,
Petr