[PATCH v2 0/3] selftests/mm: TAP output and global-state fixes

From: Song Hu

Date: Sat Aug 15 2026 - 04:08:08 EST


uffd-wp-mremap and mremap_test never print the TAP header (and mremap_test
skips with a bare exit(KSFT_SKIP) rather than a KTAP skip), so their output
is not valid KTAP; hugetlb-soft-offline toggles enable_soft_offline during
the run and leaves it disabled afterwards.

Tested on x86_64.

Song Hu (3):
selftests/mm: emit TAP header in uffd-wp-mremap
selftests/mm: emit TAP header and use TAP skip in mremap_test
selftests/mm: restore enable_soft_offline in hugetlb-soft-offline

.../selftests/mm/hugetlb-soft-offline.c | 35 ++++++----------
tools/testing/selftests/mm/mremap_test.c | 41 +++++++++++--------
tools/testing/selftests/mm/uffd-wp-mremap.c | 2 +
3 files changed, 37 insertions(+), 41 deletions(-)

---

Changes in v2, per review feedback from Mike Rapoport, Sarthak Sharma and
the Sashiko AI review Andrew Morton pointed at:

- mremap_test: save errno before fclose() in get_mmap_min_addr() so
strerror() reports the actual failure, and split the ksft_*() messages
embedding "\n\t" so continuation lines get the "# " prefix.

- hugetlb-soft-offline: restore enable_soft_offline from an atexit()
handler so it also runs on early exits, and use read_num()/write_num()
from vm_util instead of the hand-rolled helpers.

v1: https://lore.kernel.org/all/20260812120821.523860-1-husong@xxxxxxxxxx/

--
2.43.0