summaryrefslogtreecommitdiff
path: root/tools/testing/selftests
diff options
context:
space:
mode:
authorKiryl Shutsemau (Meta) <kas@kernel.org>2026-09-19 01:24:31 +0100
committerAndrew Morton <akpm@linux-foundation.org>2026-09-30 16:57:34 -0700
commite47c38bc4fc627d817d811b75cf85818e2e258b8 (patch)
treeb65cb417428bf11d423a07bc300bd62cce61cbda /tools/testing/selftests
parentb511d07e056951e60a18a1b87f60e15042970097 (diff)
downloadlinux-next-e47c38bc4fc627d817d811b75cf85818e2e258b8.tar.gz
linux-next-e47c38bc4fc627d817d811b75cf85818e2e258b8.zip
selftests/mm: raise the khugepaged test-case cap
Patch series "selftests/mm: improve khugepaged coverage", v6. khugepaged collapses to mTHP orders since 7.2, and 7.3 added three selftest cases for it: the generic collapse cases run at one order named by -c, with the result detected by counting folios of that order. That leaves the collapse path largely untested. The suite does not run where a PMD is 512M. A folio count cannot say where a collapse landed. Fixed sleeps cannot tell "not collapsed" from "not scanned yet". And nothing exercises collapse under contention. Close those gaps in order: - Make the suite run at a 512M PMD: scale the collapse wait with the PMD size, skip what such a PMD cannot serve, make the swapout the swap cases depend on deterministic, and keep khugepaged out of the MADV_COLLAPSE cases. - Detect results per window rather than by count, with folio-order helpers in vm_util that are checked against the kernel before any collapse test trusts them. - Drive khugepaged deterministically: a completion barrier that wakes the daemon and waits for a full pass, and a check that one pass yields one attributed collapse. - Cover collapse at every supported order by default: which window collapses, occupancy at both limits, sources that are already large folios, and a fork-shared source under concurrent writes. - Race collapse against everything that can touch its sources, at both occupancy limits and over whole-table zaps, checked by content and by the kernel's own assertions. Everything passes on an unmodified kernel. This patch (of 19): TEST() ends the run with "MAX_TEST_CASES is too small" when the table fills, and the table holds 64. A full invocation already registers 63, so the next case added anywhere aborts the whole suite before a single test runs. Raise the cap to 256. The table is a static array of small structs, so the room costs nothing worth counting. Link: https://lore.kernel.org/20260919002451.496763-1-kirill@shutemov.name Link: https://lore.kernel.org/20260919002451.496763-2-kirill@shutemov.name Signed-off-by: Kiryl Shutsemau (Meta) <kas@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Usama Arif <usama.arif@linux.dev> Acked-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com> Assisted-by: LLM Cc: Alexander Gordeev <agordeev@linux.ibm.com> Cc: Barry Song <baohua@kernel.org> Cc: "David Hildenbrand (arm)" <david@kernel.org> Cc: Dev Jain <dev.jain@arm.com> Cc: Hugh Dickens <hughd@google.com> Cc: Jason Gunthorpe <jgg@ziepe.ca> Cc: kernel-team@meta.com Cc: Lance Yang <lance.yang@linux.dev> Cc: Leon Romanovsky <leon@kernel.org> Cc: Liam Howlett <liam@infradead.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Muhammad Usama Anjum <usama.anjum@arm.com> Cc: Nico Pache (Red Hat) <nico.pache@linux.dev> Cc: Ryan Roberts <ryan.roberts@arm.com> Cc: Shuah Khan (Samsung OSG) <shuah@kernel.org> Cc: Suren Baghdasaryan <surenb@google.com> Cc: "Vlastimil Babka (SUSE)" <vbabka@kernel.org> Cc: Zi Yan <ziy@nvidia.com>
Diffstat (limited to 'tools/testing/selftests')
-rw-r--r--tools/testing/selftests/mm/khugepaged.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/mm/khugepaged.c b/tools/testing/selftests/mm/khugepaged.c
index 525108cace54..c44bc18f7536 100644
--- a/tools/testing/selftests/mm/khugepaged.c
+++ b/tools/testing/selftests/mm/khugepaged.c
@@ -1290,7 +1290,7 @@ struct test_case {
test_fn fn;
};
-#define MAX_TEST_CASES 64
+#define MAX_TEST_CASES 256
static struct test_case test_cases[MAX_TEST_CASES];
static int nr_test_cases;