mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/4] selftests/mm: check large folio results through check_huge() only
@ 2026-09-29 13:15 Kiryl Shutsemau
  2026-09-29 13:15 ` [PATCH 1/4] selftests/mm: open pagemap and kpageflags once for check_huge() Kiryl Shutsemau
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Kiryl Shutsemau @ 2026-09-29 13:15 UTC (permalink / raw)
  To: Andrew Morton, David Hildenbrand, Lorenzo Stoakes, Mike Rapoport,
	Zi Yan, Baolin Wang, Shuah Khan
  Cc: Kiryl Shutsemau (Meta),
	Barry Song, Dev Jain, Lance Yang, Liam R . Howlett, Michal Hocko,
	Nico Pache, Ryan Roberts, Suren Baghdasaryan, Usama Arif,
	Vlastimil Babka, Yeoreum Yun, linux-mm, linux-kselftest,
	linux-kernel, kernel-team

From: "Kiryl Shutsemau (Meta)" <kas@kernel.org>

The mm selftests had two ways to check that a range came out as folios
of a given order.  check_huge_anon() and check_huge_file() counted
folios of the order in the range.  is_range_backed_by_order() checked
each window for a folio with its head at the window start.  Baolin found
the two sets in khugepaged.c confusing [1], and the answer at the time
was to merge them once Yeoreum's rewrite of check_huge_*() on top of
pagemap and kpageflags landed.  It is in mm-new now.

Make check_huge() check windows below the PMD size, route every caller
through it, and make is_range_backed_by_order() an internal of vm_util.c.
The split test's count-based check goes the same way, which also makes
it notice a split at the wrong offset.  On the way check_huge() stops
reopening pagemap and kpageflags on every call, which was the other
reason the separate helper existed.

Tested on mm-new 2589c5593c20 with KASAN, in 16G guests, x86-64/4K under
KVM and arm64/64K under TCG: the khugepaged matrix at every order,
split_huge_page_test, pagemap_ioctl and khugepaged all:all on tmpfs pass
with the same counts as before.

[1] https://lore.kernel.org/all/65bf1722-c1fd-452a-88c1-c030b042cfbc@linux.alibaba.com/

Kiryl Shutsemau (Meta) (4):
  selftests/mm: open pagemap and kpageflags once for check_huge()
  selftests/mm: check sub-PMD ranges window by window in check_huge()
  selftests/mm: check collapse results through check_huge() only
  selftests/mm: check split results by position, drop
    gather_folio_orders()

 .../testing/selftests/mm/folio_order_check.c  |  28 +-
 tools/testing/selftests/mm/khugepaged.c       |  47 ++-
 .../selftests/mm/khugepaged_sync_check.c      |   7 +-
 .../selftests/mm/split_huge_page_test.c       | 104 +++---
 tools/testing/selftests/mm/vm_util.c          | 320 ++++++------------
 tools/testing/selftests/mm/vm_util.h          |   7 +-
 6 files changed, 176 insertions(+), 337 deletions(-)


base-commit: 2589c5593c200e5146db848730baa1d7dd0c9f4e
-- 
2.54.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-10-01 11:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-29 13:15 [PATCH 0/4] selftests/mm: check large folio results through check_huge() only Kiryl Shutsemau
2026-09-29 13:15 ` [PATCH 1/4] selftests/mm: open pagemap and kpageflags once for check_huge() Kiryl Shutsemau
2026-09-29 15:28   ` Zi Yan
2026-10-01 11:41     ` David Hildenbrand (Arm)
2026-09-29 13:15 ` [PATCH 2/4] selftests/mm: check sub-PMD ranges window by window in check_huge() Kiryl Shutsemau
2026-09-29 13:15 ` [PATCH 3/4] selftests/mm: check collapse results through check_huge() only Kiryl Shutsemau
2026-09-29 13:15 ` [PATCH 4/4] selftests/mm: check split results by position, drop gather_folio_orders() Kiryl Shutsemau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®