Re: [PATCH 1/2] selftests/mm: reuse FORCE_READ to replace "asm volatile("" : "+r" (XXX));"
From: wang lian
Date: Mon Jul 21 2025 - 07:50:15 EST
> On 17.07.25 15:18, wang lian wrote:
> > Several mm selftests use the `asm volatile("" : "+r" (variable));`
> > construct to force a read of a variable, preventing the compiler from
> > optimizing away the memory access. This idiom is cryptic and duplicated
> > across multiple test files.
> >
> > Following a suggestion from David[1], this patch refactors this
> > common pattern into a FORCE_READ() macro
> >
> > [1] https://lore.kernel.org/lkml/4a3e0759-caa1-4cfa-bc3f-402593f1eee3@xxxxxxxxxx/
> >
> > Signed-off-by: wang lian <lianux.mm@xxxxxxxxx>
> > Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
> > ---
Hi David,
Thank you for the review and the Acked-by tag. I appreciate it.
> Acked-by: David Hildenbrand <david@xxxxxxxxxx>
> --
> Cheers,
> David / dhildenb
Best regards,
Wang Lian