Re: [PATCH 0/4] selftests/mm: replace transhuge-stress with a THP compaction selftest

From: Dev Jain

Date: Sat Nov 14 2026 - 07:43:19 EST




On 12/11/26 2:32 pm, Sarthak Sharma wrote:
> transhuge-stress is a stressor tool that repeatedly
> allocates and splits THPs till a specified duration. If the
> duration elapses, the test passes and fails only if a setup or
> system call fails.
>
> This is not how a test residing in selftests/mm is supposed to
> behave. So remove it and add a new functional test called
> thp-compaction.c, that allocates THPs as much as it can,
> splits those THPs keeping one page retained and discarding
> others, and then retries allocating THPs, which will test
> if THP compaction is working fine. If we are able to recover
> more than half of the initial THPs, the test passes. Otherwise
> it fails.
>
> This was suggested by David earlier [1].
>

Isn't compaction_test.c already sort-of doing what you are trying to
do here?


> Patch 1 removes the current transhuge-stress. Patch 2 adds a check to see
> if PFNs are being masked due to no CAP_SYS_ADMIN in the initial user namespace.
> Patch 3 factors out THP split helpers from split_huge_page_test.c to vm_util.c.
> Patch 4 adds the
> new test.
>
> [1] https://lore.kernel.org/all/94ace42d-8d60-4475-953e-74fb3dc23774@xxxxxxxxxx/
>
> Sarthak Sharma (4):
> selftests/mm: remove transhuge-stress
> selftests/mm: detect masked PFNs in allocate_transhuge()
> selftests/mm: factor out THP split helpers
> selftests/mm: add a THP compaction selftest
>
> MAINTAINERS | 2 +-
> tools/testing/selftests/mm/Makefile | 2 +-
> tools/testing/selftests/mm/ksm_tests.c | 26 ++-
> tools/testing/selftests/mm/run_vmtests.sh | 2 +-
> .../selftests/mm/split_huge_page_test.c | 45 +---
> tools/testing/selftests/mm/thp-compaction.c | 215 ++++++++++++++++++
> tools/testing/selftests/mm/transhuge-stress.c | 146 ------------
> tools/testing/selftests/mm/vm_util.c | 65 ++++++
> tools/testing/selftests/mm/vm_util.h | 6 +
> 9 files changed, 313 insertions(+), 196 deletions(-)
> create mode 100644 tools/testing/selftests/mm/thp-compaction.c
> delete mode 100644 tools/testing/selftests/mm/transhuge-stress.c
>