linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: wang lian <lianux.mm@gmail.com>
To: akpm@linux-foundation.org, broonie@kernel.org, david@redhat.com,
	lorenzo.stoakes@oracle.com, sj@kernel.org, ziy@nvidia.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Cc: brauner@kernel.org, gkwang@linx-info.com, jannh@google.com,
	Liam.Howlett@oracle.com, lianux.mm@gmail.com,
	ludovico.zy.wu@gmail.com, p1ucky0923@gmail.com,
	richard.weiyang@gmail.com, ryncsn@gmail.com, shuah@kernel.org,
	vbabka@suse.cz, zijing.zhang@proton.me
Subject: [PATCH v2 0/2] selftests/mm: reuse FORCE_READ to replace "asm volatile("" : "+r" (XXX));"
Date: Thu, 17 Jul 2025 19:24:05 +0800	[thread overview]
Message-ID: <20250717112407.13507-1-lianux.mm@gmail.com> (raw)

This series introduces a common FORCE_READ() macro to replace 
the cryptic asm volatile("" : "+r" (variable)); 
construct used in several mm selftests. This improves code readability and 
maintainability by removing duplicated, hard-to-understand code.

I previously sent the refactoring patch [1] as a standalone change, following a suggestion from David. 
As Andrew Morton and Wei Yang correctly pointed out, 
that patch was incomplete as it was missing the macro definition itself, 
causing build warnings. My apologies for the noise.

[1] https://lore.kernel.org/lkml/20250716123126.3851-1-lianux.mm@gmail.com/

This v2 series corrects that mistake by properly structuring the changes:
- The first patch introduces the FORCE_READ() macro into the shared vm_util.h header 
  and includes a minor cleanup for another test.
- The second patch then uses this new macro to refactor the selftests.

changes to v2:
- collected Acked-by and Reviewed-by from  David and Lorenzo Stoakes.

wang lian (2):
  selftests/mm: refactor common code and improve test skipping in
    guard_region
  selftests/mm: reuse FORCE_READ to replace "asm volatile("" : "+r"
    (XXX));"

 tools/testing/selftests/mm/cow.c              | 30 +++++++++----------
 tools/testing/selftests/mm/guard-regions.c    |  9 +-----
 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, 32 insertions(+), 40 deletions(-)

-- 
2.43.0



             reply	other threads:[~2025-07-17 11:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-17 11:24 wang lian [this message]
2025-07-17 11:24 ` [PATCH 1/2] selftests/mm: refactor common code and improve test skipping in guard_region wang lian
2025-07-17 11:44   ` David Hildenbrand
2025-07-17 12:09     ` wang lian
2025-07-17 11:24 ` [PATCH 2/2] selftests/mm: reuse FORCE_READ to replace "asm volatile("" : "+r" (XXX));" wang lian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250717112407.13507-1-lianux.mm@gmail.com \
    --to=lianux.mm@gmail.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=broonie@kernel.org \
    --cc=david@redhat.com \
    --cc=gkwang@linx-info.com \
    --cc=jannh@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=ludovico.zy.wu@gmail.com \
    --cc=p1ucky0923@gmail.com \
    --cc=richard.weiyang@gmail.com \
    --cc=ryncsn@gmail.com \
    --cc=shuah@kernel.org \
    --cc=sj@kernel.org \
    --cc=vbabka@suse.cz \
    --cc=zijing.zhang@proton.me \
    --cc=ziy@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).