[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2173758C-0BFE-4AFE-BF46-A32F69F1CBCA@nvidia.com>
Date: Fri, 18 Jul 2025 11:11:23 -0400
From: Zi Yan <ziy@...dia.com>
To: wang lian <lianux.mm@...il.com>
Cc: akpm@...ux-foundation.org, broonie@...nel.org, david@...hat.com,
lorenzo.stoakes@...cle.com, sj@...nel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, brauner@...nel.org, gkwang@...x-info.com,
jannh@...gle.com, Liam.Howlett@...cle.com, ludovico.zy.wu@...il.com,
p1ucky0923@...il.com, richard.weiyang@...il.com, ryncsn@...il.com,
shuah@...nel.org, vbabka@...e.cz, zijing.zhang@...ton.me
Subject: Re: [PATCH 1/2] selftests/mm: reuse FORCE_READ to replace "asm
volatile("" : "+r" (XXX));"
On 17 Jul 2025, at 9: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@redhat.com/
>
> Signed-off-by: wang lian <lianux.mm@...il.com>
> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
> ---
> tools/testing/selftests/mm/cow.c | 30 +++++++++----------
> tools/testing/selftests/mm/guard-regions.c | 7 -----
> tools/testing/selftests/mm/hugetlb-madvise.c | 5 +---
> tools/testing/selftests/mm/migration.c | 13 ++++----
> tools/testing/selftests/mm/pagemap_ioctl.c | 4 +--
> .../selftests/mm/split_huge_page_test.c | 4 +--
> tools/testing/selftests/mm/vm_util.h | 7 +++++
> 7 files changed, 31 insertions(+), 39 deletions(-)
Reviewed-by: Zi Yan <ziy@...dia.com>
Best Regards,
Yan, Zi
Powered by blists - more mailing lists