[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250717065828.cxnjfrl3iir5eb6y@master>
Date: Thu, 17 Jul 2025 06:58:28 +0000
From: Wei Yang <richard.weiyang@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: wang lian <lianux.mm@...il.com>, broonie@...nel.org, david@...hat.com,
lorenzo.stoakes@...cle.com, sj@...nel.org, ziy@...dia.com,
linux-mm@...ck.org, linux-kernel@...r.kernel.org,
brauner@...nel.org, jannh@...gle.com, Liam.Howlett@...cle.com,
shuah@...nel.org, vbabka@...e.cz, ludovico.zy.wu@...il.com,
gkwang@...x-info.com, p1ucky0923@...il.com, ryncsn@...il.com,
zijing.zhang@...ton.me
Subject: Re: [PATCH] selftests/mm: reuse FORCE_READ to replace "asm
volatile("" : "+r" (XXX));"
On Wed, Jul 16, 2025 at 03:15:43PM -0700, Andrew Morton wrote:
>On Wed, 16 Jul 2025 20:31:26 +0800 wang lian <lianux.mm@...il.com> 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
>>
>> tools/testing/selftests/mm/cow.c | 30 +++++++++----------
>> 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 +--
>> 5 files changed, 24 insertions(+), 32 deletions(-)
>
>The patch forgot to move the FORCE_READ definition into a header?
>
I get this after applying the patch.
cow.c:1559:9: warning: implicit declaration of function ‘FORCE_READ’; did you mean ‘LOCK_READ’? [-Wimplicit-function-declaration]
1559 | FORCE_READ(mem);
--
Wei Yang
Help you, Help me
Powered by blists - more mailing lists