[PATCH] selftests/mm: Have the harness run each test category separately

Mark Brown posted 1 patch 2 weeks, 6 days ago
There is a newer version of this series
tools/testing/selftests/mm/Makefile                | 29 +++++++++++++++++++++-
tools/testing/selftests/mm/ksft_compaction.sh      |  4 +++
tools/testing/selftests/mm/ksft_cow.sh             |  4 +++
tools/testing/selftests/mm/ksft_gup_test.sh        |  4 +++
tools/testing/selftests/mm/ksft_hmm.sh             |  4 +++
tools/testing/selftests/mm/ksft_hugetlb.sh         |  4 +++
tools/testing/selftests/mm/ksft_hugevm.sh          |  4 +++
tools/testing/selftests/mm/ksft_ksm.sh             |  4 +++
tools/testing/selftests/mm/ksft_ksm_numa.sh        |  4 +++
tools/testing/selftests/mm/ksft_madv_guard.sh      |  4 +++
tools/testing/selftests/mm/ksft_madv_populate.sh   |  4 +++
tools/testing/selftests/mm/ksft_mdwe.sh            |  4 +++
tools/testing/selftests/mm/ksft_memfd_secret.sh    |  4 +++
tools/testing/selftests/mm/ksft_migration.sh       |  4 +++
tools/testing/selftests/mm/ksft_mkdirty.sh         |  4 +++
tools/testing/selftests/mm/ksft_mlock.sh           |  4 +++
tools/testing/selftests/mm/ksft_mmap.sh            |  4 +++
tools/testing/selftests/mm/ksft_mremap.sh          |  4 +++
tools/testing/selftests/mm/ksft_page_frag.sh       |  4 +++
tools/testing/selftests/mm/ksft_pagemap.sh         |  4 +++
tools/testing/selftests/mm/ksft_pfnmap.sh          |  4 +++
tools/testing/selftests/mm/ksft_pkey.sh            |  4 +++
tools/testing/selftests/mm/ksft_process_madv.sh    |  4 +++
.../testing/selftests/mm/ksft_process_mrelease.sh  |  4 +++
tools/testing/selftests/mm/ksft_rmap.sh            |  4 +++
tools/testing/selftests/mm/ksft_soft_dirty.sh      |  4 +++
tools/testing/selftests/mm/ksft_thp.sh             |  4 +++
tools/testing/selftests/mm/ksft_userfaultfd.sh     |  4 +++
tools/testing/selftests/mm/ksft_vma_merge.sh       |  4 +++
tools/testing/selftests/mm/ksft_vmalloc.sh         |  4 +++
30 files changed, 144 insertions(+), 1 deletion(-)
[PATCH] selftests/mm: Have the harness run each test category separately
Posted by Mark Brown 2 weeks, 6 days ago
At present the mm selftests are integrated into the kselftest harness by
having it run run_vmtest.sh and letting it pick it's default set of
tests to invoke, rather than by telling the kselftest framework about
each test program individually as is more standard.   This has some
unfortunate interactions with the kselftest harness:

 - If any of the tests hangs the harness will kill the entire mm
   selftests run rather than just the individual test, meaning no
   further tests get run.
 - The timeout applied by the harness is applied to the whole run rather
   than an individual test which frequently leads to the suite not being
   completed in production testing.

Deploy a crude but effective mitigation for these issues by telling the
kselftest framework to run each of the test categories that run_vmtests.sh
has separately.  Since kselftest really wants to run test programs this
is done by providing a trivial wrapper script for each categorty that
invokes run_vmtest.sh, this is not a thing of great elegence but it is
clear and simple.  Since run_vmtests.sh is doing runtime support
detection, scenario enumeration and setup for many of the tests we can't
consistently tell the framework about the individual test programs.

This has the side effect of reordering the tests, hopefully the testing
is not overly sensitive to this.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 tools/testing/selftests/mm/Makefile                | 29 +++++++++++++++++++++-
 tools/testing/selftests/mm/ksft_compaction.sh      |  4 +++
 tools/testing/selftests/mm/ksft_cow.sh             |  4 +++
 tools/testing/selftests/mm/ksft_gup_test.sh        |  4 +++
 tools/testing/selftests/mm/ksft_hmm.sh             |  4 +++
 tools/testing/selftests/mm/ksft_hugetlb.sh         |  4 +++
 tools/testing/selftests/mm/ksft_hugevm.sh          |  4 +++
 tools/testing/selftests/mm/ksft_ksm.sh             |  4 +++
 tools/testing/selftests/mm/ksft_ksm_numa.sh        |  4 +++
 tools/testing/selftests/mm/ksft_madv_guard.sh      |  4 +++
 tools/testing/selftests/mm/ksft_madv_populate.sh   |  4 +++
 tools/testing/selftests/mm/ksft_mdwe.sh            |  4 +++
 tools/testing/selftests/mm/ksft_memfd_secret.sh    |  4 +++
 tools/testing/selftests/mm/ksft_migration.sh       |  4 +++
 tools/testing/selftests/mm/ksft_mkdirty.sh         |  4 +++
 tools/testing/selftests/mm/ksft_mlock.sh           |  4 +++
 tools/testing/selftests/mm/ksft_mmap.sh            |  4 +++
 tools/testing/selftests/mm/ksft_mremap.sh          |  4 +++
 tools/testing/selftests/mm/ksft_page_frag.sh       |  4 +++
 tools/testing/selftests/mm/ksft_pagemap.sh         |  4 +++
 tools/testing/selftests/mm/ksft_pfnmap.sh          |  4 +++
 tools/testing/selftests/mm/ksft_pkey.sh            |  4 +++
 tools/testing/selftests/mm/ksft_process_madv.sh    |  4 +++
 .../testing/selftests/mm/ksft_process_mrelease.sh  |  4 +++
 tools/testing/selftests/mm/ksft_rmap.sh            |  4 +++
 tools/testing/selftests/mm/ksft_soft_dirty.sh      |  4 +++
 tools/testing/selftests/mm/ksft_thp.sh             |  4 +++
 tools/testing/selftests/mm/ksft_userfaultfd.sh     |  4 +++
 tools/testing/selftests/mm/ksft_vma_merge.sh       |  4 +++
 tools/testing/selftests/mm/ksft_vmalloc.sh         |  4 +++
 30 files changed, 144 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile
index eaf9312097f7..69f10947735a 100644
--- a/tools/testing/selftests/mm/Makefile
+++ b/tools/testing/selftests/mm/Makefile
@@ -146,7 +146,33 @@ endif
 TEST_GEN_FILES += write_to_hugetlbfs
 endif
 
-TEST_PROGS := run_vmtests.sh
+TEST_PROGS += ksft_compaction.sh
+TEST_PROGS += ksft_cow.sh
+TEST_PROGS += ksft_gup_test.sh
+TEST_PROGS += ksft_hmm.sh
+TEST_PROGS += ksft_hugetlb.sh
+TEST_PROGS += ksft_hugevm.sh
+TEST_PROGS += ksft_ksm.sh
+TEST_PROGS += ksft_ksm_numa.sh
+TEST_PROGS += ksft_madv_guard.sh
+TEST_PROGS += ksft_madv_populate.sh
+TEST_PROGS += ksft_memfd_secret.sh
+TEST_PROGS += ksft_migration.sh
+TEST_PROGS += ksft_mkdirty.sh
+TEST_PROGS += ksft_mlock.sh
+TEST_PROGS += ksft_mmap.sh
+TEST_PROGS += ksft_mremap.sh
+TEST_PROGS += ksft_pagemap.sh
+TEST_PROGS += ksft_pfnmap.sh
+TEST_PROGS += ksft_pkey.sh
+TEST_PROGS += ksft_process_madv.sh
+TEST_PROGS += ksft_process_mrelease.sh
+TEST_PROGS += ksft_rmap.sh
+TEST_PROGS += ksft_soft_dirty.sh
+TEST_PROGS += ksft_thp.sh
+TEST_PROGS += ksft_userfaultfd.sh
+TEST_PROGS += ksft_vma_merge.sh
+TEST_PROGS += ksft_vmalloc.sh
 
 TEST_FILES := test_vmalloc.sh
 TEST_FILES += test_hmm.sh
@@ -154,6 +180,7 @@ TEST_FILES += va_high_addr_switch.sh
 TEST_FILES += charge_reserved_hugetlb.sh
 TEST_FILES += hugetlb_reparenting_test.sh
 TEST_FILES += test_page_frag.sh
+TEST_FILES += run_vmtests.sh
 
 # required by charge_reserved_hugetlb.sh
 TEST_FILES += write_hugetlb_memory.sh
diff --git a/tools/testing/selftests/mm/ksft_compaction.sh b/tools/testing/selftests/mm/ksft_compaction.sh
new file mode 100755
index 000000000000..1f38f4228a34
--- /dev/null
+++ b/tools/testing/selftests/mm/ksft_compaction.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+# SPDX-License-Identifier: GPL-2.0
+
+./run_vmtests.sh -t compaction
diff --git a/tools/testing/selftests/mm/ksft_cow.sh b/tools/testing/selftests/mm/ksft_cow.sh
new file mode 100755
index 000000000000..1e03a95fd5f6
--- /dev/null
+++ b/tools/testing/selftests/mm/ksft_cow.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+# SPDX-License-Identifier: GPL-2.0
+
+./run_vmtests.sh -t cow
diff --git a/tools/testing/selftests/mm/ksft_gup_test.sh b/tools/testing/selftests/mm/ksft_gup_test.sh
new file mode 100755
index 000000000000..09e586d2f446
--- /dev/null
+++ b/tools/testing/selftests/mm/ksft_gup_test.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+# SPDX-License-Identifier: GPL-2.0
+
+./run_vmtests.sh -t gup_test
diff --git a/tools/testing/selftests/mm/ksft_hmm.sh b/tools/testing/selftests/mm/ksft_hmm.sh
new file mode 100755
index 000000000000..0a7b04f454d5
--- /dev/null
+++ b/tools/testing/selftests/mm/ksft_hmm.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+# SPDX-License-Identifier: GPL-2.0
+
+./run_vmtests.sh -t hmm
diff --git a/tools/testing/selftests/mm/ksft_hugetlb.sh b/tools/testing/selftests/mm/ksft_hugetlb.sh
new file mode 100755
index 000000000000..4f92974a4eb5
--- /dev/null
+++ b/tools/testing/selftests/mm/ksft_hugetlb.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+# SPDX-License-Identifier: GPL-2.0
+
+./run_vmtests.sh -t hugetlb
diff --git a/tools/testing/selftests/mm/ksft_hugevm.sh b/tools/testing/selftests/mm/ksft_hugevm.sh
new file mode 100755
index 000000000000..377967fe9c91
--- /dev/null
+++ b/tools/testing/selftests/mm/ksft_hugevm.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+# SPDX-License-Identifier: GPL-2.0
+
+./run_vmtests.sh -t hugevm
diff --git a/tools/testing/selftests/mm/ksft_ksm.sh b/tools/testing/selftests/mm/ksft_ksm.sh
new file mode 100755
index 000000000000..f6a6fe13a3b0
--- /dev/null
+++ b/tools/testing/selftests/mm/ksft_ksm.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+# SPDX-License-Identifier: GPL-2.0
+
+./run_vmtests.sh -t ksm
diff --git a/tools/testing/selftests/mm/ksft_ksm_numa.sh b/tools/testing/selftests/mm/ksft_ksm_numa.sh
new file mode 100755
index 000000000000..144b41a5e3bb
--- /dev/null
+++ b/tools/testing/selftests/mm/ksft_ksm_numa.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+# SPDX-License-Identifier: GPL-2.0
+
+./run_vmtests.sh -t ksm_numa
diff --git a/tools/testing/selftests/mm/ksft_madv_guard.sh b/tools/testing/selftests/mm/ksft_madv_guard.sh
new file mode 100755
index 000000000000..2d810c049182
--- /dev/null
+++ b/tools/testing/selftests/mm/ksft_madv_guard.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+# SPDX-License-Identifier: GPL-2.0
+
+./run_vmtests.sh -t madv_guard
diff --git a/tools/testing/selftests/mm/ksft_madv_populate.sh b/tools/testing/selftests/mm/ksft_madv_populate.sh
new file mode 100755
index 000000000000..127e22ed02c4
--- /dev/null
+++ b/tools/testing/selftests/mm/ksft_madv_populate.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+# SPDX-License-Identifier: GPL-2.0
+
+./run_vmtests.sh -t madv_populate
diff --git a/tools/testing/selftests/mm/ksft_mdwe.sh b/tools/testing/selftests/mm/ksft_mdwe.sh
new file mode 100755
index 000000000000..3dcae95ddabc
--- /dev/null
+++ b/tools/testing/selftests/mm/ksft_mdwe.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+# SPDX-License-Identifier: GPL-2.0
+
+./run_vmtests.sh -t mdwe
diff --git a/tools/testing/selftests/mm/ksft_memfd_secret.sh b/tools/testing/selftests/mm/ksft_memfd_secret.sh
new file mode 100755
index 000000000000..56e82dd648a7
--- /dev/null
+++ b/tools/testing/selftests/mm/ksft_memfd_secret.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+# SPDX-License-Identifier: GPL-2.0
+
+./run_vmtests.sh -t memfd_secret
diff --git a/tools/testing/selftests/mm/ksft_migration.sh b/tools/testing/selftests/mm/ksft_migration.sh
new file mode 100755
index 000000000000..7cf37c72d26e
--- /dev/null
+++ b/tools/testing/selftests/mm/ksft_migration.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+# SPDX-License-Identifier: GPL-2.0
+
+./run_vmtests.sh -t migration
diff --git a/tools/testing/selftests/mm/ksft_mkdirty.sh b/tools/testing/selftests/mm/ksft_mkdirty.sh
new file mode 100755
index 000000000000..dd6332df3204
--- /dev/null
+++ b/tools/testing/selftests/mm/ksft_mkdirty.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+# SPDX-License-Identifier: GPL-2.0
+
+./run_vmtests.sh -t mkdirty
diff --git a/tools/testing/selftests/mm/ksft_mlock.sh b/tools/testing/selftests/mm/ksft_mlock.sh
new file mode 100755
index 000000000000..1e25ab9fdc8b
--- /dev/null
+++ b/tools/testing/selftests/mm/ksft_mlock.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+# SPDX-License-Identifier: GPL-2.0
+
+./run_vmtests.sh -t mlock
diff --git a/tools/testing/selftests/mm/ksft_mmap.sh b/tools/testing/selftests/mm/ksft_mmap.sh
new file mode 100755
index 000000000000..2c3137ae8bc8
--- /dev/null
+++ b/tools/testing/selftests/mm/ksft_mmap.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+# SPDX-License-Identifier: GPL-2.0
+
+./run_vmtests.sh -t mmap
diff --git a/tools/testing/selftests/mm/ksft_mremap.sh b/tools/testing/selftests/mm/ksft_mremap.sh
new file mode 100755
index 000000000000..4101670d0e19
--- /dev/null
+++ b/tools/testing/selftests/mm/ksft_mremap.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+# SPDX-License-Identifier: GPL-2.0
+
+./run_vmtests.sh -t mremap
diff --git a/tools/testing/selftests/mm/ksft_page_frag.sh b/tools/testing/selftests/mm/ksft_page_frag.sh
new file mode 100755
index 000000000000..216e20ffe390
--- /dev/null
+++ b/tools/testing/selftests/mm/ksft_page_frag.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+# SPDX-License-Identifier: GPL-2.0
+
+./run_vmtests.sh -t page_frag
diff --git a/tools/testing/selftests/mm/ksft_pagemap.sh b/tools/testing/selftests/mm/ksft_pagemap.sh
new file mode 100755
index 000000000000..b8d270fdd43e
--- /dev/null
+++ b/tools/testing/selftests/mm/ksft_pagemap.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+# SPDX-License-Identifier: GPL-2.0
+
+./run_vmtests.sh -t pagemap
diff --git a/tools/testing/selftests/mm/ksft_pfnmap.sh b/tools/testing/selftests/mm/ksft_pfnmap.sh
new file mode 100755
index 000000000000..75758de968bb
--- /dev/null
+++ b/tools/testing/selftests/mm/ksft_pfnmap.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+# SPDX-License-Identifier: GPL-2.0
+
+./run_vmtests.sh -t pfnmap
diff --git a/tools/testing/selftests/mm/ksft_pkey.sh b/tools/testing/selftests/mm/ksft_pkey.sh
new file mode 100755
index 000000000000..ac944233b7f7
--- /dev/null
+++ b/tools/testing/selftests/mm/ksft_pkey.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+# SPDX-License-Identifier: GPL-2.0
+
+./run_vmtests.sh -t pkey
diff --git a/tools/testing/selftests/mm/ksft_process_madv.sh b/tools/testing/selftests/mm/ksft_process_madv.sh
new file mode 100755
index 000000000000..2c3137ae8bc8
--- /dev/null
+++ b/tools/testing/selftests/mm/ksft_process_madv.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+# SPDX-License-Identifier: GPL-2.0
+
+./run_vmtests.sh -t mmap
diff --git a/tools/testing/selftests/mm/ksft_process_mrelease.sh b/tools/testing/selftests/mm/ksft_process_mrelease.sh
new file mode 100755
index 000000000000..f560aa5e4218
--- /dev/null
+++ b/tools/testing/selftests/mm/ksft_process_mrelease.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+# SPDX-License-Identifier: GPL-2.0
+
+./run_vmtests.sh -t process_mrelease
diff --git a/tools/testing/selftests/mm/ksft_rmap.sh b/tools/testing/selftests/mm/ksft_rmap.sh
new file mode 100755
index 000000000000..974742b9b02f
--- /dev/null
+++ b/tools/testing/selftests/mm/ksft_rmap.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+# SPDX-License-Identifier: GPL-2.0
+
+./run_vmtests.sh -t rmap
diff --git a/tools/testing/selftests/mm/ksft_soft_dirty.sh b/tools/testing/selftests/mm/ksft_soft_dirty.sh
new file mode 100755
index 000000000000..d160d7fea0a9
--- /dev/null
+++ b/tools/testing/selftests/mm/ksft_soft_dirty.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+# SPDX-License-Identifier: GPL-2.0
+
+./run_vmtests.sh -t soft_dirty
diff --git a/tools/testing/selftests/mm/ksft_thp.sh b/tools/testing/selftests/mm/ksft_thp.sh
new file mode 100755
index 000000000000..95321aecabdb
--- /dev/null
+++ b/tools/testing/selftests/mm/ksft_thp.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+# SPDX-License-Identifier: GPL-2.0
+
+./run_vmtests.sh -t thp
diff --git a/tools/testing/selftests/mm/ksft_userfaultfd.sh b/tools/testing/selftests/mm/ksft_userfaultfd.sh
new file mode 100755
index 000000000000..92667abde6c6
--- /dev/null
+++ b/tools/testing/selftests/mm/ksft_userfaultfd.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+# SPDX-License-Identifier: GPL-2.0
+
+./run_vmtests.sh -t userfaultfd
diff --git a/tools/testing/selftests/mm/ksft_vma_merge.sh b/tools/testing/selftests/mm/ksft_vma_merge.sh
new file mode 100755
index 000000000000..68449d840680
--- /dev/null
+++ b/tools/testing/selftests/mm/ksft_vma_merge.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+# SPDX-License-Identifier: GPL-2.0
+
+./run_vmtests.sh -t vma_merge
diff --git a/tools/testing/selftests/mm/ksft_vmalloc.sh b/tools/testing/selftests/mm/ksft_vmalloc.sh
new file mode 100755
index 000000000000..0b5019a76612
--- /dev/null
+++ b/tools/testing/selftests/mm/ksft_vmalloc.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+# SPDX-License-Identifier: GPL-2.0
+
+./run_vmtests.sh -t vmalloc

---
base-commit: 24d479d26b25bce5faea3ddd9fa8f3a6c3129ea7
change-id: 20260119-selftests-mm-run-suites-separately-6a4dada136c4

Best regards,
--  
Mark Brown <broonie@kernel.org>
Re: [PATCH] selftests/mm: Have the harness run each test category separately
Posted by Lorenzo Stoakes 2 weeks, 3 days ago
On Tue, Jan 20, 2026 at 01:25:32PM +0000, Mark Brown wrote:
> At present the mm selftests are integrated into the kselftest harness by
> having it run run_vmtest.sh and letting it pick it's default set of
> tests to invoke, rather than by telling the kselftest framework about
> each test program individually as is more standard.   This has some
> unfortunate interactions with the kselftest harness:
>
>  - If any of the tests hangs the harness will kill the entire mm
>    selftests run rather than just the individual test, meaning no
>    further tests get run.
>  - The timeout applied by the harness is applied to the whole run rather
>    than an individual test which frequently leads to the suite not being
>    completed in production testing.
>
> Deploy a crude but effective mitigation for these issues by telling the
> kselftest framework to run each of the test categories that run_vmtests.sh
> has separately.  Since kselftest really wants to run test programs this
> is done by providing a trivial wrapper script for each categorty that
> invokes run_vmtest.sh, this is not a thing of great elegence but it is
> clear and simple.  Since run_vmtests.sh is doing runtime support
> detection, scenario enumeration and setup for many of the tests we can't
> consistently tell the framework about the individual test programs.
>
> This has the side effect of reordering the tests, hopefully the testing
> is not overly sensitive to this.
>
> Signed-off-by: Mark Brown <broonie@kernel.org>

Thanks so much for looking at this! I'm keen to get this sorted ASAP as I'm
concerned we're missing test failures a fair bit here.

Will help out with review on this.

So yeah obviously this is kinda crude, but if this is really the only
possibility at least for now, let's run with it because the present
situation is _SO_ broken we have to do something here.

I feel it's fairly urgent so :)

Just a couple small comments below!

Cheers, Lorenzo

> ---
>  tools/testing/selftests/mm/Makefile                | 29 +++++++++++++++++++++-
>  tools/testing/selftests/mm/ksft_compaction.sh      |  4 +++
>  tools/testing/selftests/mm/ksft_cow.sh             |  4 +++
>  tools/testing/selftests/mm/ksft_gup_test.sh        |  4 +++
>  tools/testing/selftests/mm/ksft_hmm.sh             |  4 +++
>  tools/testing/selftests/mm/ksft_hugetlb.sh         |  4 +++
>  tools/testing/selftests/mm/ksft_hugevm.sh          |  4 +++
>  tools/testing/selftests/mm/ksft_ksm.sh             |  4 +++
>  tools/testing/selftests/mm/ksft_ksm_numa.sh        |  4 +++
>  tools/testing/selftests/mm/ksft_madv_guard.sh      |  4 +++
>  tools/testing/selftests/mm/ksft_madv_populate.sh   |  4 +++
>  tools/testing/selftests/mm/ksft_mdwe.sh            |  4 +++
>  tools/testing/selftests/mm/ksft_memfd_secret.sh    |  4 +++
>  tools/testing/selftests/mm/ksft_migration.sh       |  4 +++
>  tools/testing/selftests/mm/ksft_mkdirty.sh         |  4 +++
>  tools/testing/selftests/mm/ksft_mlock.sh           |  4 +++
>  tools/testing/selftests/mm/ksft_mmap.sh            |  4 +++
>  tools/testing/selftests/mm/ksft_mremap.sh          |  4 +++
>  tools/testing/selftests/mm/ksft_page_frag.sh       |  4 +++
>  tools/testing/selftests/mm/ksft_pagemap.sh         |  4 +++
>  tools/testing/selftests/mm/ksft_pfnmap.sh          |  4 +++
>  tools/testing/selftests/mm/ksft_pkey.sh            |  4 +++
>  tools/testing/selftests/mm/ksft_process_madv.sh    |  4 +++
>  .../testing/selftests/mm/ksft_process_mrelease.sh  |  4 +++
>  tools/testing/selftests/mm/ksft_rmap.sh            |  4 +++
>  tools/testing/selftests/mm/ksft_soft_dirty.sh      |  4 +++
>  tools/testing/selftests/mm/ksft_thp.sh             |  4 +++
>  tools/testing/selftests/mm/ksft_userfaultfd.sh     |  4 +++
>  tools/testing/selftests/mm/ksft_vma_merge.sh       |  4 +++
>  tools/testing/selftests/mm/ksft_vmalloc.sh         |  4 +++
>  30 files changed, 144 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile
> index eaf9312097f7..69f10947735a 100644
> --- a/tools/testing/selftests/mm/Makefile
> +++ b/tools/testing/selftests/mm/Makefile
> @@ -146,7 +146,33 @@ endif
>  TEST_GEN_FILES += write_to_hugetlbfs
>  endif
>

I think while we're being crude here, a comment inserted at the top of the
Makefile is sensible?

People have to edit this file to add a new test anyway so should see
it. Something like:

# IMPORTANT: If you add a new test CATEGORY please add a simple wrapper
# script so kunit knows to run it, and add it to the list below.
# If you do not YOUR TESTS WILL NOT RUN IN THE CI.

> -TEST_PROGS := run_vmtests.sh
> +TEST_PROGS += ksft_compaction.sh
> +TEST_PROGS += ksft_cow.sh
> +TEST_PROGS += ksft_gup_test.sh
> +TEST_PROGS += ksft_hmm.sh
> +TEST_PROGS += ksft_hugetlb.sh
> +TEST_PROGS += ksft_hugevm.sh
> +TEST_PROGS += ksft_ksm.sh
> +TEST_PROGS += ksft_ksm_numa.sh
> +TEST_PROGS += ksft_madv_guard.sh
> +TEST_PROGS += ksft_madv_populate.sh
> +TEST_PROGS += ksft_memfd_secret.sh
> +TEST_PROGS += ksft_migration.sh
> +TEST_PROGS += ksft_mkdirty.sh
> +TEST_PROGS += ksft_mlock.sh
> +TEST_PROGS += ksft_mmap.sh
> +TEST_PROGS += ksft_mremap.sh
> +TEST_PROGS += ksft_pagemap.sh
> +TEST_PROGS += ksft_pfnmap.sh
> +TEST_PROGS += ksft_pkey.sh
> +TEST_PROGS += ksft_process_madv.sh
> +TEST_PROGS += ksft_process_mrelease.sh
> +TEST_PROGS += ksft_rmap.sh
> +TEST_PROGS += ksft_soft_dirty.sh
> +TEST_PROGS += ksft_thp.sh
> +TEST_PROGS += ksft_userfaultfd.sh
> +TEST_PROGS += ksft_vma_merge.sh
> +TEST_PROGS += ksft_vmalloc.sh

Is this something that only kunit will interpret, or will it impact the
build in any other way?

I'm guessing the former.

>
>  TEST_FILES := test_vmalloc.sh
>  TEST_FILES += test_hmm.sh
> @@ -154,6 +180,7 @@ TEST_FILES += va_high_addr_switch.sh
>  TEST_FILES += charge_reserved_hugetlb.sh
>  TEST_FILES += hugetlb_reparenting_test.sh
>  TEST_FILES += test_page_frag.sh
> +TEST_FILES += run_vmtests.sh
>
>  # required by charge_reserved_hugetlb.sh
>  TEST_FILES += write_hugetlb_memory.sh
> diff --git a/tools/testing/selftests/mm/ksft_compaction.sh b/tools/testing/selftests/mm/ksft_compaction.sh
> new file mode 100755
> index 000000000000..1f38f4228a34
> --- /dev/null
> +++ b/tools/testing/selftests/mm/ksft_compaction.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh -e
> +# SPDX-License-Identifier: GPL-2.0
> +
> +./run_vmtests.sh -t compaction
> diff --git a/tools/testing/selftests/mm/ksft_cow.sh b/tools/testing/selftests/mm/ksft_cow.sh
> new file mode 100755
> index 000000000000..1e03a95fd5f6
> --- /dev/null
> +++ b/tools/testing/selftests/mm/ksft_cow.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh -e
> +# SPDX-License-Identifier: GPL-2.0
> +
> +./run_vmtests.sh -t cow
> diff --git a/tools/testing/selftests/mm/ksft_gup_test.sh b/tools/testing/selftests/mm/ksft_gup_test.sh
> new file mode 100755
> index 000000000000..09e586d2f446
> --- /dev/null
> +++ b/tools/testing/selftests/mm/ksft_gup_test.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh -e
> +# SPDX-License-Identifier: GPL-2.0
> +
> +./run_vmtests.sh -t gup_test
> diff --git a/tools/testing/selftests/mm/ksft_hmm.sh b/tools/testing/selftests/mm/ksft_hmm.sh
> new file mode 100755
> index 000000000000..0a7b04f454d5
> --- /dev/null
> +++ b/tools/testing/selftests/mm/ksft_hmm.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh -e
> +# SPDX-License-Identifier: GPL-2.0
> +
> +./run_vmtests.sh -t hmm
> diff --git a/tools/testing/selftests/mm/ksft_hugetlb.sh b/tools/testing/selftests/mm/ksft_hugetlb.sh
> new file mode 100755
> index 000000000000..4f92974a4eb5
> --- /dev/null
> +++ b/tools/testing/selftests/mm/ksft_hugetlb.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh -e
> +# SPDX-License-Identifier: GPL-2.0
> +
> +./run_vmtests.sh -t hugetlb
> diff --git a/tools/testing/selftests/mm/ksft_hugevm.sh b/tools/testing/selftests/mm/ksft_hugevm.sh
> new file mode 100755
> index 000000000000..377967fe9c91
> --- /dev/null
> +++ b/tools/testing/selftests/mm/ksft_hugevm.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh -e
> +# SPDX-License-Identifier: GPL-2.0
> +
> +./run_vmtests.sh -t hugevm
> diff --git a/tools/testing/selftests/mm/ksft_ksm.sh b/tools/testing/selftests/mm/ksft_ksm.sh
> new file mode 100755
> index 000000000000..f6a6fe13a3b0
> --- /dev/null
> +++ b/tools/testing/selftests/mm/ksft_ksm.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh -e
> +# SPDX-License-Identifier: GPL-2.0
> +
> +./run_vmtests.sh -t ksm
> diff --git a/tools/testing/selftests/mm/ksft_ksm_numa.sh b/tools/testing/selftests/mm/ksft_ksm_numa.sh
> new file mode 100755
> index 000000000000..144b41a5e3bb
> --- /dev/null
> +++ b/tools/testing/selftests/mm/ksft_ksm_numa.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh -e
> +# SPDX-License-Identifier: GPL-2.0
> +
> +./run_vmtests.sh -t ksm_numa
> diff --git a/tools/testing/selftests/mm/ksft_madv_guard.sh b/tools/testing/selftests/mm/ksft_madv_guard.sh
> new file mode 100755
> index 000000000000..2d810c049182
> --- /dev/null
> +++ b/tools/testing/selftests/mm/ksft_madv_guard.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh -e
> +# SPDX-License-Identifier: GPL-2.0
> +
> +./run_vmtests.sh -t madv_guard
> diff --git a/tools/testing/selftests/mm/ksft_madv_populate.sh b/tools/testing/selftests/mm/ksft_madv_populate.sh
> new file mode 100755
> index 000000000000..127e22ed02c4
> --- /dev/null
> +++ b/tools/testing/selftests/mm/ksft_madv_populate.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh -e
> +# SPDX-License-Identifier: GPL-2.0
> +
> +./run_vmtests.sh -t madv_populate
> diff --git a/tools/testing/selftests/mm/ksft_mdwe.sh b/tools/testing/selftests/mm/ksft_mdwe.sh
> new file mode 100755
> index 000000000000..3dcae95ddabc
> --- /dev/null
> +++ b/tools/testing/selftests/mm/ksft_mdwe.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh -e
> +# SPDX-License-Identifier: GPL-2.0
> +
> +./run_vmtests.sh -t mdwe
> diff --git a/tools/testing/selftests/mm/ksft_memfd_secret.sh b/tools/testing/selftests/mm/ksft_memfd_secret.sh
> new file mode 100755
> index 000000000000..56e82dd648a7
> --- /dev/null
> +++ b/tools/testing/selftests/mm/ksft_memfd_secret.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh -e
> +# SPDX-License-Identifier: GPL-2.0
> +
> +./run_vmtests.sh -t memfd_secret
> diff --git a/tools/testing/selftests/mm/ksft_migration.sh b/tools/testing/selftests/mm/ksft_migration.sh
> new file mode 100755
> index 000000000000..7cf37c72d26e
> --- /dev/null
> +++ b/tools/testing/selftests/mm/ksft_migration.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh -e
> +# SPDX-License-Identifier: GPL-2.0
> +
> +./run_vmtests.sh -t migration
> diff --git a/tools/testing/selftests/mm/ksft_mkdirty.sh b/tools/testing/selftests/mm/ksft_mkdirty.sh
> new file mode 100755
> index 000000000000..dd6332df3204
> --- /dev/null
> +++ b/tools/testing/selftests/mm/ksft_mkdirty.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh -e
> +# SPDX-License-Identifier: GPL-2.0
> +
> +./run_vmtests.sh -t mkdirty
> diff --git a/tools/testing/selftests/mm/ksft_mlock.sh b/tools/testing/selftests/mm/ksft_mlock.sh
> new file mode 100755
> index 000000000000..1e25ab9fdc8b
> --- /dev/null
> +++ b/tools/testing/selftests/mm/ksft_mlock.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh -e
> +# SPDX-License-Identifier: GPL-2.0
> +
> +./run_vmtests.sh -t mlock
> diff --git a/tools/testing/selftests/mm/ksft_mmap.sh b/tools/testing/selftests/mm/ksft_mmap.sh
> new file mode 100755
> index 000000000000..2c3137ae8bc8
> --- /dev/null
> +++ b/tools/testing/selftests/mm/ksft_mmap.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh -e
> +# SPDX-License-Identifier: GPL-2.0
> +
> +./run_vmtests.sh -t mmap
> diff --git a/tools/testing/selftests/mm/ksft_mremap.sh b/tools/testing/selftests/mm/ksft_mremap.sh
> new file mode 100755
> index 000000000000..4101670d0e19
> --- /dev/null
> +++ b/tools/testing/selftests/mm/ksft_mremap.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh -e
> +# SPDX-License-Identifier: GPL-2.0
> +
> +./run_vmtests.sh -t mremap
> diff --git a/tools/testing/selftests/mm/ksft_page_frag.sh b/tools/testing/selftests/mm/ksft_page_frag.sh
> new file mode 100755
> index 000000000000..216e20ffe390
> --- /dev/null
> +++ b/tools/testing/selftests/mm/ksft_page_frag.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh -e
> +# SPDX-License-Identifier: GPL-2.0
> +
> +./run_vmtests.sh -t page_frag
> diff --git a/tools/testing/selftests/mm/ksft_pagemap.sh b/tools/testing/selftests/mm/ksft_pagemap.sh
> new file mode 100755
> index 000000000000..b8d270fdd43e
> --- /dev/null
> +++ b/tools/testing/selftests/mm/ksft_pagemap.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh -e
> +# SPDX-License-Identifier: GPL-2.0
> +
> +./run_vmtests.sh -t pagemap
> diff --git a/tools/testing/selftests/mm/ksft_pfnmap.sh b/tools/testing/selftests/mm/ksft_pfnmap.sh
> new file mode 100755
> index 000000000000..75758de968bb
> --- /dev/null
> +++ b/tools/testing/selftests/mm/ksft_pfnmap.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh -e
> +# SPDX-License-Identifier: GPL-2.0
> +
> +./run_vmtests.sh -t pfnmap
> diff --git a/tools/testing/selftests/mm/ksft_pkey.sh b/tools/testing/selftests/mm/ksft_pkey.sh
> new file mode 100755
> index 000000000000..ac944233b7f7
> --- /dev/null
> +++ b/tools/testing/selftests/mm/ksft_pkey.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh -e
> +# SPDX-License-Identifier: GPL-2.0
> +
> +./run_vmtests.sh -t pkey
> diff --git a/tools/testing/selftests/mm/ksft_process_madv.sh b/tools/testing/selftests/mm/ksft_process_madv.sh
> new file mode 100755
> index 000000000000..2c3137ae8bc8
> --- /dev/null
> +++ b/tools/testing/selftests/mm/ksft_process_madv.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh -e
> +# SPDX-License-Identifier: GPL-2.0
> +
> +./run_vmtests.sh -t mmap
> diff --git a/tools/testing/selftests/mm/ksft_process_mrelease.sh b/tools/testing/selftests/mm/ksft_process_mrelease.sh
> new file mode 100755
> index 000000000000..f560aa5e4218
> --- /dev/null
> +++ b/tools/testing/selftests/mm/ksft_process_mrelease.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh -e
> +# SPDX-License-Identifier: GPL-2.0
> +
> +./run_vmtests.sh -t process_mrelease
> diff --git a/tools/testing/selftests/mm/ksft_rmap.sh b/tools/testing/selftests/mm/ksft_rmap.sh
> new file mode 100755
> index 000000000000..974742b9b02f
> --- /dev/null
> +++ b/tools/testing/selftests/mm/ksft_rmap.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh -e
> +# SPDX-License-Identifier: GPL-2.0
> +
> +./run_vmtests.sh -t rmap
> diff --git a/tools/testing/selftests/mm/ksft_soft_dirty.sh b/tools/testing/selftests/mm/ksft_soft_dirty.sh
> new file mode 100755
> index 000000000000..d160d7fea0a9
> --- /dev/null
> +++ b/tools/testing/selftests/mm/ksft_soft_dirty.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh -e
> +# SPDX-License-Identifier: GPL-2.0
> +
> +./run_vmtests.sh -t soft_dirty
> diff --git a/tools/testing/selftests/mm/ksft_thp.sh b/tools/testing/selftests/mm/ksft_thp.sh
> new file mode 100755
> index 000000000000..95321aecabdb
> --- /dev/null
> +++ b/tools/testing/selftests/mm/ksft_thp.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh -e
> +# SPDX-License-Identifier: GPL-2.0
> +
> +./run_vmtests.sh -t thp
> diff --git a/tools/testing/selftests/mm/ksft_userfaultfd.sh b/tools/testing/selftests/mm/ksft_userfaultfd.sh
> new file mode 100755
> index 000000000000..92667abde6c6
> --- /dev/null
> +++ b/tools/testing/selftests/mm/ksft_userfaultfd.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh -e
> +# SPDX-License-Identifier: GPL-2.0
> +
> +./run_vmtests.sh -t userfaultfd
> diff --git a/tools/testing/selftests/mm/ksft_vma_merge.sh b/tools/testing/selftests/mm/ksft_vma_merge.sh
> new file mode 100755
> index 000000000000..68449d840680
> --- /dev/null
> +++ b/tools/testing/selftests/mm/ksft_vma_merge.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh -e
> +# SPDX-License-Identifier: GPL-2.0
> +
> +./run_vmtests.sh -t vma_merge
> diff --git a/tools/testing/selftests/mm/ksft_vmalloc.sh b/tools/testing/selftests/mm/ksft_vmalloc.sh
> new file mode 100755
> index 000000000000..0b5019a76612
> --- /dev/null
> +++ b/tools/testing/selftests/mm/ksft_vmalloc.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh -e
> +# SPDX-License-Identifier: GPL-2.0
> +
> +./run_vmtests.sh -t vmalloc
>
> ---
> base-commit: 24d479d26b25bce5faea3ddd9fa8f3a6c3129ea7
> change-id: 20260119-selftests-mm-run-suites-separately-6a4dada136c4
>
> Best regards,
> --
> Mark Brown <broonie@kernel.org>
>
Re: [PATCH] selftests/mm: Have the harness run each test category separately
Posted by Mark Brown 2 weeks, 3 days ago
On Thu, Jan 22, 2026 at 07:13:06PM +0000, Lorenzo Stoakes wrote:

> People have to edit this file to add a new test anyway so should see
> it. Something like:

> # IMPORTANT: If you add a new test CATEGORY please add a simple wrapper
> # script so kunit knows to run it, and add it to the list below.
> # If you do not YOUR TESTS WILL NOT RUN IN THE CI.

Is the Makefile the place for that or run_vmtests.sh?  You don't need to
edit the Makefile to add a category.

> > +TEST_PROGS += ksft_vmalloc.sh

> Is this something that only kunit will interpret, or will it impact the
> build in any other way?

KUnit isn't involved here?  This is just how you specify which programs
are run by kselftest, this is a Makefile in the kselftest framework.
Re: [PATCH] selftests/mm: Have the harness run each test category separately
Posted by Lorenzo Stoakes 2 weeks, 3 days ago
On Fri, Jan 23, 2026 at 11:21:39AM +0000, Mark Brown wrote:
> On Thu, Jan 22, 2026 at 07:13:06PM +0000, Lorenzo Stoakes wrote:
>
> > People have to edit this file to add a new test anyway so should see
> > it. Something like:
>
> > # IMPORTANT: If you add a new test CATEGORY please add a simple wrapper
> > # script so kunit knows to run it, and add it to the list below.
> > # If you do not YOUR TESTS WILL NOT RUN IN THE CI.
>
> Is the Makefile the place for that or run_vmtests.sh?  You don't need to
> edit the Makefile to add a category.

As I said, you have to edit the Make file to _add a new test_.

The point being you will necessarily see this. It'd be fairly odd to add a new
category without adding a new test.

And since you'd need to update the Makefile, putting this comment at the top of
the file immediately next to where you have to put it makes sense.

I mean by all means add it to run_vmtests.sh also.

It's all a hack, but at least this way it reduces the odds of people missing
this.

>
> > > +TEST_PROGS += ksft_vmalloc.sh
>
> > Is this something that only kunit will interpret, or will it impact the
> > build in any other way?
>
> KUnit isn't involved here?  This is just how you specify which programs
> are run by kselftest, this is a Makefile in the kselftest framework.

s/kunit/kselftest/.

I use the mm selftests locally by running sudo ./run_vmtests.sh directly. So I
don't know how TEST_GEN_PROGS interacts with anything else.
Re: [PATCH] selftests/mm: Have the harness run each test category separately
Posted by Mark Brown 2 weeks, 3 days ago
On Fri, Jan 23, 2026 at 12:09:52PM +0000, Lorenzo Stoakes wrote:
> On Fri, Jan 23, 2026 at 11:21:39AM +0000, Mark Brown wrote:
> > On Thu, Jan 22, 2026 at 07:13:06PM +0000, Lorenzo Stoakes wrote:

> > > # IMPORTANT: If you add a new test CATEGORY please add a simple wrapper
> > > # script so kunit knows to run it, and add it to the list below.
> > > # If you do not YOUR TESTS WILL NOT RUN IN THE CI.

> > Is the Makefile the place for that or run_vmtests.sh?  You don't need to
> > edit the Makefile to add a category.

> As I said, you have to edit the Make file to _add a new test_.

> The point being you will necessarily see this. It'd be fairly odd to add a new
> category without adding a new test.

You do, but adding the category is actually done in run_vmtests.sh and I
can see someone doing something like adding the test to the Makefile to
build the test while still developing it, then going back and hooking it 
up to run_vmtests.sh when they're satisfied that things work and
deciding at that point that it doesn't fit with any of the existing
categories.

> And since you'd need to update the Makefile, putting this comment at the top of
> the file immediately next to where you have to put it makes sense.

I guess.  At the top of the Makefile or right next to where you have to
add the tests?  There's about 50 lines of setup at the top of the
Makefile before you get to all the TEST_GEN_FILES.

> > > > +TEST_PROGS += ksft_vmalloc.sh

> > > Is this something that only kunit will interpret, or will it impact the
> > > build in any other way?

> > KUnit isn't involved here?  This is just how you specify which programs
> > are run by kselftest, this is a Makefile in the kselftest framework.

> s/kunit/kselftest/.

> I use the mm selftests locally by running sudo ./run_vmtests.sh directly. So I
> don't know how TEST_GEN_PROGS interacts with anything else.

If you're not invoking any of the kselftest infrastructure it's not
going to do anything, nothing execept make looks at the Makefile.  When
you do a build it'll result in the specified binary being built (and
installed if you ask for that) but not otherwise interacted with by the
generic framework.  See:

   https://docs.kernel.org/dev-tools/kselftest.html

for the various variables that the build system has for suite Makefiles.
Re: [PATCH] selftests/mm: Have the harness run each test category separately
Posted by Lorenzo Stoakes 2 weeks, 3 days ago
On Fri, Jan 23, 2026 at 12:35:06PM +0000, Mark Brown wrote:
> On Fri, Jan 23, 2026 at 12:09:52PM +0000, Lorenzo Stoakes wrote:
> > On Fri, Jan 23, 2026 at 11:21:39AM +0000, Mark Brown wrote:
> > > On Thu, Jan 22, 2026 at 07:13:06PM +0000, Lorenzo Stoakes wrote:
>
> > > > # IMPORTANT: If you add a new test CATEGORY please add a simple wrapper
> > > > # script so kunit knows to run it, and add it to the list below.
> > > > # If you do not YOUR TESTS WILL NOT RUN IN THE CI.
>
> > > Is the Makefile the place for that or run_vmtests.sh?  You don't need to
> > > edit the Makefile to add a category.
>
> > As I said, you have to edit the Make file to _add a new test_.
>
> > The point being you will necessarily see this. It'd be fairly odd to add a new
> > category without adding a new test.
>
> You do, but adding the category is actually done in run_vmtests.sh and I
> can see someone doing something like adding the test to the Makefile to
> build the test while still developing it, then going back and hooking it
> up to run_vmtests.sh when they're satisfied that things work and
> deciding at that point that it doesn't fit with any of the existing
> categories.

Right sure, so maybe worth putting in both.

All of this is pretty icky but it's important to get this running ASAP and live
with the ick for now, we can do something better later.

>
> > And since you'd need to update the Makefile, putting this comment at the top of
> > the file immediately next to where you have to put it makes sense.
>
> I guess.  At the top of the Makefile or right next to where you have to
> add the tests?  There's about 50 lines of setup at the top of the
> Makefile before you get to all the TEST_GEN_FILES.

I'd say right at the top, for both run_vmtests.sh and the Makefile, thanks.

>
> > > > > +TEST_PROGS += ksft_vmalloc.sh
>
> > > > Is this something that only kunit will interpret, or will it impact the
> > > > build in any other way?
>
> > > KUnit isn't involved here?  This is just how you specify which programs
> > > are run by kselftest, this is a Makefile in the kselftest framework.
>
> > s/kunit/kselftest/.
>
> > I use the mm selftests locally by running sudo ./run_vmtests.sh directly. So I
> > don't know how TEST_GEN_PROGS interacts with anything else.
>
> If you're not invoking any of the kselftest infrastructure it's not
> going to do anything, nothing execept make looks at the Makefile.  When
> you do a build it'll result in the specified binary being built (and
> installed if you ask for that) but not otherwise interacted with by the
> generic framework.  See:
>
>    https://docs.kernel.org/dev-tools/kselftest.html
>
> for the various variables that the build system has for suite Makefiles.

Ack thanks!

Cheers, Lorenzo
Re: [PATCH] selftests/mm: Have the harness run each test category separately
Posted by Andrew Morton 2 weeks, 5 days ago
On Tue, 20 Jan 2026 13:25:32 +0000 Mark Brown <broonie@kernel.org> wrote:

> At present the mm selftests are integrated into the kselftest harness by
> having it run run_vmtest.sh and letting it pick it's default set of
> tests to invoke, rather than by telling the kselftest framework about
> each test program individually as is more standard.   This has some
> unfortunate interactions with the kselftest harness:
> 
>  - If any of the tests hangs the harness will kill the entire mm
>    selftests run rather than just the individual test, meaning no
>    further tests get run.
>  - The timeout applied by the harness is applied to the whole run rather
>    than an individual test which frequently leads to the suite not being
>    completed in production testing.
> 
> Deploy a crude but effective mitigation for these issues by telling the
> kselftest framework to run each of the test categories that run_vmtests.sh
> has separately.  Since kselftest really wants to run test programs this
> is done by providing a trivial wrapper script for each categorty that
> invokes run_vmtest.sh, this is not a thing of great elegence but it is
> clear and simple.  Since run_vmtests.sh is doing runtime support
> detection, scenario enumeration and setup for many of the tests we can't
> consistently tell the framework about the individual test programs.
> 
> This has the side effect of reordering the tests, hopefully the testing
> is not overly sensitive to this.

Thanks, let's see what people think.

What happens with tests which are newly added but which don't integrate
into this new framework?  eg,
https://lkml.kernel.org/r/20260120123239.909882-2-linmiaohe@huawei.com
Re: [PATCH] selftests/mm: Have the harness run each test category separately
Posted by Mark Brown 2 weeks, 5 days ago
On Tue, Jan 20, 2026 at 09:22:52AM -0800, Andrew Morton wrote:
> On Tue, 20 Jan 2026 13:25:32 +0000 Mark Brown <broonie@kernel.org> wrote:

> > has separately.  Since kselftest really wants to run test programs this
> > is done by providing a trivial wrapper script for each categorty that
> > invokes run_vmtest.sh, this is not a thing of great elegence but it is
> > clear and simple.  Since run_vmtests.sh is doing runtime support
> > detection, scenario enumeration and setup for many of the tests we can't
> > consistently tell the framework about the individual test programs.

> Thanks, let's see what people think.

> What happens with tests which are newly added but which don't integrate
> into this new framework?  eg,
> https://lkml.kernel.org/r/20260120123239.909882-2-linmiaohe@huawei.com

Anything adding a new category will just not get run by the kselftest
harness until someone adds a wrapper script for them, they'll still get
run if someone invokes run_vmtest.sh with no arguments directly.  As the
changelog says it's not particularly nice, but hopefully people don't
add new categories all that often.