* [PATCH 0/4] selftests/mm: skip several tests when thp is not available
@ 2026-03-12 11:26 Chunyu Hu
2026-03-12 11:35 ` Chunyu Hu
0 siblings, 1 reply; 34+ messages in thread
From: Chunyu Hu @ 2026-03-12 11:26 UTC (permalink / raw)
To: akpm, david, shuah, linux-mm, ljs
Cc: linux-kselftest, linux-kernel, lorenzo.stoakes, Liam.Howlett,
vbabka, rppt, surenb, mhocko, ziy, baolin.wang, npache,
ryan.roberts, dev.jain, baohua, lance.yang, chuhu
There are several tests requires transprarent hugepages, when run on thp
disabled kernel such as realtime kernel, there will be false positve.
Mark those tests as skip when thp is not available.
Chunye Hu (4):
selftests/mm/guard-regions: skip collapse test when thp not enabled
selftests/mm: soft-dirty: skip two tests when thp not available
selftests/mm: split_huge_page_test: skip the test when thp not
available
selftests/mm: transhuge_stress: skip the test when thp not available
tools/testing/selftests/mm/guard-regions.c | 4 ++++
tools/testing/selftests/mm/soft-dirty.c | 4 +++-
tools/testing/selftests/mm/split_huge_page_test.c | 9 +++++++--
tools/testing/selftests/mm/transhuge-stress.c | 4 ++++
4 files changed, 18 insertions(+), 3 deletions(-)
base-commit: 80234b5ab240f52fa45d201e899e207b9265ef91
--
2.53.0
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 0/4] selftests/mm: skip several tests when thp is not available
2026-03-12 11:26 Chunyu Hu
@ 2026-03-12 11:35 ` Chunyu Hu
0 siblings, 0 replies; 34+ messages in thread
From: Chunyu Hu @ 2026-03-12 11:35 UTC (permalink / raw)
To: akpm, david, shuah, linux-mm, ljs
Cc: linux-kselftest, linux-kernel, lorenzo.stoakes, Liam.Howlett,
vbabka, rppt, surenb, mhocko, ziy, baolin.wang, npache,
ryan.roberts, dev.jain, baohua, lance.yang
[-- Attachment #1: Type: text/plain, Size: 1141 bytes --]
On Thu, Mar 12, 2026 at 7:26 PM Chunyu Hu <chuhu@redhat.com> wrote:
> There are several tests requires transprarent hugepages, when run on thp
> disabled kernel such as realtime kernel, there will be false positve.
> Mark those tests as skip when thp is not available.
>
> Chunye Hu (4):
> selftests/mm/guard-regions: skip collapse test when thp not enabled
> selftests/mm: soft-dirty: skip two tests when thp not available
> selftests/mm: split_huge_page_test: skip the test when thp not
> available
> selftests/mm: transhuge_stress: skip the test when thp not available
>
> tools/testing/selftests/mm/guard-regions.c | 4 ++++
> tools/testing/selftests/mm/soft-dirty.c | 4 +++-
> tools/testing/selftests/mm/split_huge_page_test.c | 9 +++++++--
> tools/testing/selftests/mm/transhuge-stress.c | 4 ++++
> 4 files changed, 18 insertions(+), 3 deletions(-)
>
Apologies, a duplicate patch 2/4 was sent with minor different titles,
I'll resend the patches.
>
>
> base-commit: 80234b5ab240f52fa45d201e899e207b9265ef91
> --
> 2.53.0
>
>
--
----
Thanks,
Chunyu Hu
[-- Attachment #2: Type: text/html, Size: 2062 bytes --]
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH 0/4] selftests/mm: skip several tests when thp is not available
@ 2026-03-12 11:40 Chunyu Hu
2026-03-12 11:40 ` [RESEND PATCH 1/4] selftests/mm/guard-regions: skip collapse test when thp not enabled Chunyu Hu
` (5 more replies)
0 siblings, 6 replies; 34+ messages in thread
From: Chunyu Hu @ 2026-03-12 11:40 UTC (permalink / raw)
To: akpm, david, shuah, linux-mm, ljs
Cc: linux-kselftest, linux-kernel, lorenzo.stoakes, Liam.Howlett,
vbabka, rppt, surenb, mhocko, ziy, baolin.wang, npache,
ryan.roberts, dev.jain, baohua, lance.yang, chuhu
There are several tests requires transprarent hugepages, when run on thp
disabled kernel such as realtime kernel, there will be false positve.
Mark those tests as skip when thp is not available.
Chunye Hu (4):
selftests/mm/guard-regions: skip collapse test when thp not enabled
selftests/mm: soft-dirty: skip two tests when thp not available
selftests/mm: split_huge_page_test: skip the test when thp not
available
selftests/mm: transhuge_stress: skip the test when thp not available
tools/testing/selftests/mm/guard-regions.c | 4 ++++
tools/testing/selftests/mm/soft-dirty.c | 4 +++-
tools/testing/selftests/mm/split_huge_page_test.c | 9 +++++++--
tools/testing/selftests/mm/transhuge-stress.c | 4 ++++
4 files changed, 18 insertions(+), 3 deletions(-)
base-commit: 80234b5ab240f52fa45d201e899e207b9265ef91
--
2.53.0
^ permalink raw reply [flat|nested] 34+ messages in thread
* [RESEND PATCH 1/4] selftests/mm/guard-regions: skip collapse test when thp not enabled
2026-03-12 11:40 [PATCH 0/4] selftests/mm: skip several tests when thp is not available Chunyu Hu
@ 2026-03-12 11:40 ` Chunyu Hu
2026-03-12 13:58 ` Zi Yan
` (2 more replies)
2026-03-12 11:40 ` [RESEND PATCH 2/4] selftests/mm: soft-dirty: skip two tests when thp is not available Chunyu Hu
` (4 subsequent siblings)
5 siblings, 3 replies; 34+ messages in thread
From: Chunyu Hu @ 2026-03-12 11:40 UTC (permalink / raw)
To: akpm, david, shuah, linux-mm, ljs
Cc: linux-kselftest, linux-kernel, lorenzo.stoakes, Liam.Howlett,
vbabka, rppt, surenb, mhocko, ziy, baolin.wang, npache,
ryan.roberts, dev.jain, baohua, lance.yang, chuhu, Li Wang
When thp is not available, just skip the collape tests to avoid the false
positive.
Without the change, run with a thp disabled kernel:
./run_vmtests.sh -t madv_guard
<snip/>
# # RUN guard_regions.file.multi_vma ...
# # OK guard_regions.file.multi_vma
# ok 89 guard_regions.file.multi_vma
# # RUN guard_regions.file.basic ...
# # OK guard_regions.file.basic
# ok 90 guard_regions.file.basic
# # FAILED: 87 / 90 tests passed.
# # 17 skipped test(s) detected. Consider enabling relevant config options to improve coverage.
# # Totals: pass:70 fail:3 xfail:0 xpass:0 skip:17 error:0
# [FAIL]
not ok 1 guard-regions # exit=1
hwpoison_inject
# SUMMARY: PASS=0 SKIP=0 FAIL=1
With this change, run with thp disabled kernel:
./run_vmtests.sh -t madv_guard
<snip/>
# ok 90 guard_regions.file.basic
# # PASSED: 90 / 90 tests passed.
# # 20 skipped test(s) detected. Consider enabling relevant config options to improve coverage.
# # Totals: pass:70 fail:0 xfail:0 xpass:0 skip:20 error:0
# [PASS]
ok 1 guard-regions
hwpoison_inject
# SUMMARY: PASS=1 SKIP=0 FAIL=0
1..1
CC: Li Wang <liwang@redhat.com>
Signed-off-by: Chunyu Hu <chuhu@redhat.com>
---
tools/testing/selftests/mm/guard-regions.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/testing/selftests/mm/guard-regions.c b/tools/testing/selftests/mm/guard-regions.c
index dbd21d66d383..897af9c512f9 100644
--- a/tools/testing/selftests/mm/guard-regions.c
+++ b/tools/testing/selftests/mm/guard-regions.c
@@ -21,6 +21,7 @@
#include <sys/uio.h>
#include <unistd.h>
#include "vm_util.h"
+#include "thp_settings.h"
#include "../pidfd/pidfd.h"
@@ -2195,6 +2196,9 @@ TEST_F(guard_regions, collapse)
char *ptr;
int i;
+ if (!thp_is_enabled())
+ SKIP(return, "Transparent Hugepages not available\n");
+
/* Need file to be correct size for tests for non-anon. */
if (variant->backing != ANON_BACKED)
ASSERT_EQ(ftruncate(self->fd, size), 0);
--
2.53.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [RESEND PATCH 2/4] selftests/mm: soft-dirty: skip two tests when thp is not available
2026-03-12 11:40 [PATCH 0/4] selftests/mm: skip several tests when thp is not available Chunyu Hu
2026-03-12 11:40 ` [RESEND PATCH 1/4] selftests/mm/guard-regions: skip collapse test when thp not enabled Chunyu Hu
@ 2026-03-12 11:40 ` Chunyu Hu
2026-03-12 14:00 ` Zi Yan
` (2 more replies)
2026-03-12 11:40 ` [RESEND PATCH 3/4] selftests/mm: split_huge_page_test: skip the test " Chunyu Hu
` (3 subsequent siblings)
5 siblings, 3 replies; 34+ messages in thread
From: Chunyu Hu @ 2026-03-12 11:40 UTC (permalink / raw)
To: akpm, david, shuah, linux-mm, ljs
Cc: linux-kselftest, linux-kernel, lorenzo.stoakes, Liam.Howlett,
vbabka, rppt, surenb, mhocko, ziy, baolin.wang, npache,
ryan.roberts, dev.jain, baohua, lance.yang, chuhu, Li Wang
The test_hugepage test contain two sub tests. If just reporting one skip
when thp not available, there will be error in the log because the test
count don't match the test plan. Change to skip two tests by running the
ksft_test_result_skip twice in this case.
Without the fix (run test on thp disabled kernel):
./run_vmtests.sh -t soft_dirty
# --------------------
# running ./soft-dirty
# --------------------
# TAP version 13
# 1..19
# ok 1 Test test_simple
# ok 2 Test test_vma_reuse dirty bit of allocated page
# ok 3 Test test_vma_reuse dirty bit of reused address page
# ok 4 # SKIP Transparent Hugepages not available
# ok 5 Test test_mprotect-anon dirty bit of new written page
# ok 6 Test test_mprotect-anon soft-dirty clear after clear_refs
# ok 7 Test test_mprotect-anon soft-dirty clear after marking RO
# ok 8 Test test_mprotect-anon soft-dirty clear after marking RW
# ok 9 Test test_mprotect-anon soft-dirty after rewritten
# ok 10 Test test_mprotect-file dirty bit of new written page
# ok 11 Test test_mprotect-file soft-dirty clear after clear_refs
# ok 12 Test test_mprotect-file soft-dirty clear after marking RO
# ok 13 Test test_mprotect-file soft-dirty clear after marking RW
# ok 14 Test test_mprotect-file soft-dirty after rewritten
# ok 15 Test test_merge-anon soft-dirty after remap merge 1st pg
# ok 16 Test test_merge-anon soft-dirty after remap merge 2nd pg
# ok 17 Test test_merge-anon soft-dirty after mprotect merge 1st pg
# ok 18 Test test_merge-anon soft-dirty after mprotect merge 2nd pg
# # 1 skipped test(s) detected. Consider enabling relevant config options to improve coverage.
# # Planned tests != run tests (19 != 18)
# # Totals: pass:17 fail:0 xfail:0 xpass:0 skip:1 error:0
# [FAIL]
not ok 52 soft-dirty # exit=1
With the fix (run test on thp disabled kernel):
./run_vmtests.sh -t soft_dirty
# --------------------
# running ./soft-dirty
# TAP version 13
# --------------------
# running ./soft-dirty
# --------------------
# TAP version 13
# 1..19
# ok 1 Test test_simple
# ok 2 Test test_vma_reuse dirty bit of allocated page
# ok 3 Test test_vma_reuse dirty bit of reused address page
# # Transparent Hugepages not available
# ok 4 # SKIP Test test_hugepage huge page allocation
# ok 5 # SKIP Test test_hugepage huge page dirty bit
# ok 6 Test test_mprotect-anon dirty bit of new written page
# ok 7 Test test_mprotect-anon soft-dirty clear after clear_refs
# ok 8 Test test_mprotect-anon soft-dirty clear after marking RO
# ok 9 Test test_mprotect-anon soft-dirty clear after marking RW
# ok 10 Test test_mprotect-anon soft-dirty after rewritten
# ok 11 Test test_mprotect-file dirty bit of new written page
# ok 12 Test test_mprotect-file soft-dirty clear after clear_refs
# ok 13 Test test_mprotect-file soft-dirty clear after marking RO
# ok 14 Test test_mprotect-file soft-dirty clear after marking RW
# ok 15 Test test_mprotect-file soft-dirty after rewritten
# ok 16 Test test_merge-anon soft-dirty after remap merge 1st pg
# ok 17 Test test_merge-anon soft-dirty after remap merge 2nd pg
# ok 18 Test test_merge-anon soft-dirty after mprotect merge 1st pg
# ok 19 Test test_merge-anon soft-dirty after mprotect merge 2nd pg
# # 2 skipped test(s) detected. Consider enabling relevant config options to improve coverage.
# # Totals: pass:17 fail:0 xfail:0 xpass:0 skip:2 error:0
# [PASS]
ok 1 soft-dirty
hwpoison_inject
# SUMMARY: PASS=1 SKIP=0 FAIL=0
1..1
CC: Li Wang <liwang@redhat.com>
Signed-off-by: Chunyu Hu <chuhu@redhat.com>
---
tools/testing/selftests/mm/soft-dirty.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/mm/soft-dirty.c b/tools/testing/selftests/mm/soft-dirty.c
index 59c0dbe99a9b..bcfcac99b436 100644
--- a/tools/testing/selftests/mm/soft-dirty.c
+++ b/tools/testing/selftests/mm/soft-dirty.c
@@ -82,7 +82,9 @@ static void test_hugepage(int pagemap_fd, int pagesize)
int i, ret;
if (!thp_is_enabled()) {
- ksft_test_result_skip("Transparent Hugepages not available\n");
+ ksft_print_msg("Transparent Hugepages not available\n");
+ ksft_test_result_skip("Test %s huge page allocation\n", __func__);
+ ksft_test_result_skip("Test %s huge page dirty bit\n", __func__);
return;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [RESEND PATCH 3/4] selftests/mm: split_huge_page_test: skip the test when thp is not available
2026-03-12 11:40 [PATCH 0/4] selftests/mm: skip several tests when thp is not available Chunyu Hu
2026-03-12 11:40 ` [RESEND PATCH 1/4] selftests/mm/guard-regions: skip collapse test when thp not enabled Chunyu Hu
2026-03-12 11:40 ` [RESEND PATCH 2/4] selftests/mm: soft-dirty: skip two tests when thp is not available Chunyu Hu
@ 2026-03-12 11:40 ` Chunyu Hu
2026-03-12 14:11 ` Zi Yan
2026-03-12 19:44 ` David Hildenbrand (Arm)
2026-03-12 11:40 ` [RESEND PATCH 4/4] selftests/mm: transhuge_stress: skip the test when thp " Chunyu Hu
` (2 subsequent siblings)
5 siblings, 2 replies; 34+ messages in thread
From: Chunyu Hu @ 2026-03-12 11:40 UTC (permalink / raw)
To: akpm, david, shuah, linux-mm, ljs
Cc: linux-kselftest, linux-kernel, lorenzo.stoakes, Liam.Howlett,
vbabka, rppt, surenb, mhocko, ziy, baolin.wang, npache,
ryan.roberts, dev.jain, baohua, lance.yang, chuhu, Li Wang
When thp is not enabled on some kernel config such as realtime kernel, the
test will report failure. Fix the false positive by skipping the test
directly when thp is not enabled.
There's a naming conflict on write_file() function, both thp_settings.h and
split_huge_page_test.c define it. To make use of thp_is_enabled() helper in
the thp_settings.h, rename this local write_file to safe_write_file to
avoid the conflict. The reason to use 'safe_' is it does some error check.
Tested with thp disabled kernel:
Before The fix:
# --------------------------------------------------
# running ./split_huge_page_test /tmp/xfs_dir_Ywup9p
# --------------------------------------------------
# TAP version 13
# Bail out! Reading PMD pagesize failed
# # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:0 error:0
# [FAIL]
not ok 61 split_huge_page_test /tmp/xfs_dir_Ywup9p # exit=1
After the fix:
# --------------------------------------------------
# running ./split_huge_page_test /tmp/xfs_dir_YHPUPl
# --------------------------------------------------
# TAP version 13
# 1..0 # SKIP Transparent Hugepages not available
# [SKIP]
ok 6 split_huge_page_test /tmp/xfs_dir_YHPUPl # SKIP
CC: Li Wang <liwang@redhat.com>
Signed-off-by: Chunyu Hu <chuhu@redhat.com>
---
tools/testing/selftests/mm/split_huge_page_test.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/mm/split_huge_page_test.c b/tools/testing/selftests/mm/split_huge_page_test.c
index e0167111bdd1..615b75ca62cc 100644
--- a/tools/testing/selftests/mm/split_huge_page_test.c
+++ b/tools/testing/selftests/mm/split_huge_page_test.c
@@ -21,6 +21,7 @@
#include <time.h>
#include "vm_util.h"
#include "kselftest.h"
+#include "thp_settings.h"
uint64_t pagesize;
unsigned int pageshift;
@@ -255,7 +256,7 @@ static int check_after_split_folio_orders(char *vaddr_start, size_t len,
return status;
}
-static void write_file(const char *path, const char *buf, size_t buflen)
+static void safe_write_file(const char *path, const char *buf, size_t buflen)
{
int fd;
ssize_t numwritten;
@@ -283,7 +284,7 @@ static void write_debugfs(const char *fmt, ...)
if (ret >= INPUT_MAX)
ksft_exit_fail_msg("%s: Debugfs input is too long\n", __func__);
- write_file(SPLIT_DEBUGFS, input, ret + 1);
+ safe_write_file(SPLIT_DEBUGFS, input, ret + 1);
}
static char *allocate_zero_filled_hugepage(size_t len)
@@ -772,6 +773,10 @@ int main(int argc, char **argv)
ksft_finished();
}
+ if (!thp_is_enabled()) {
+ ksft_exit_skip("Transparent Hugepages not available\n");
+ }
+
if (argc > 1)
optional_xfs_path = argv[1];
--
2.53.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [RESEND PATCH 4/4] selftests/mm: transhuge_stress: skip the test when thp not available
2026-03-12 11:40 [PATCH 0/4] selftests/mm: skip several tests when thp is not available Chunyu Hu
` (2 preceding siblings ...)
2026-03-12 11:40 ` [RESEND PATCH 3/4] selftests/mm: split_huge_page_test: skip the test " Chunyu Hu
@ 2026-03-12 11:40 ` Chunyu Hu
2026-03-12 14:11 ` Zi Yan
2026-03-12 19:46 ` David Hildenbrand (Arm)
2026-03-12 14:03 ` [PATCH 0/4] selftests/mm: skip several tests when thp is " Mike Rapoport
2026-03-12 19:39 ` David Hildenbrand (Arm)
5 siblings, 2 replies; 34+ messages in thread
From: Chunyu Hu @ 2026-03-12 11:40 UTC (permalink / raw)
To: akpm, david, shuah, linux-mm, ljs
Cc: linux-kselftest, linux-kernel, lorenzo.stoakes, Liam.Howlett,
vbabka, rppt, surenb, mhocko, ziy, baolin.wang, npache,
ryan.roberts, dev.jain, baohua, lance.yang, chuhu, Li Wang
The test requires thp, skip the test when thp is not available to avoid
false positive.
Tested with thp disabled kernel.
Before the fix:
# --------------------------------
# running ./transhuge-stress -d 20
# --------------------------------
# TAP version 13
# 1..1
# transhuge-stress: allocate 1453 transhuge pages, using 2907 MiB virtual memory and 11 MiB of ram
# Bail out! MADV_HUGEPAGE# Planned tests != run tests (1 != 0)
# # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:0 error:0
# [FAIL]
not ok 60 transhuge-stress -d 20 # exit=1
After the fix:
# --------------------------------
# running ./transhuge-stress -d 20
# --------------------------------
# 1..0 # SKIP Transparent Hugepages not available
# [SKIP]
ok 5 transhuge-stress -d 20 # SKIP
CC: Li Wang <liwang@redhat.com>
Signed-off-by: Chunyu Hu <chuhu@redhat.com>
---
tools/testing/selftests/mm/transhuge-stress.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/testing/selftests/mm/transhuge-stress.c b/tools/testing/selftests/mm/transhuge-stress.c
index bcad47c09518..76316696426d 100644
--- a/tools/testing/selftests/mm/transhuge-stress.c
+++ b/tools/testing/selftests/mm/transhuge-stress.c
@@ -17,6 +17,7 @@
#include <sys/mman.h>
#include "vm_util.h"
#include "kselftest.h"
+#include "thp_settings.h"
int backing_fd = -1;
int mmap_flags = MAP_ANONYMOUS | MAP_NORESERVE | MAP_PRIVATE;
@@ -35,6 +36,9 @@ int main(int argc, char **argv)
int pagemap_fd;
int duration = 0;
+ if (!thp_is_enabled())
+ ksft_exit_skip("Transparent Hugepages not available\n");
+
ksft_print_header();
ram = sysconf(_SC_PHYS_PAGES);
--
2.53.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* Re: [RESEND PATCH 1/4] selftests/mm/guard-regions: skip collapse test when thp not enabled
2026-03-12 11:40 ` [RESEND PATCH 1/4] selftests/mm/guard-regions: skip collapse test when thp not enabled Chunyu Hu
@ 2026-03-12 13:58 ` Zi Yan
2026-03-12 19:48 ` David Hildenbrand (Arm)
2026-03-13 15:35 ` Lorenzo Stoakes (Oracle)
2 siblings, 0 replies; 34+ messages in thread
From: Zi Yan @ 2026-03-12 13:58 UTC (permalink / raw)
To: Chunyu Hu
Cc: akpm, david, shuah, linux-mm, ljs, linux-kselftest, linux-kernel,
lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb, mhocko,
baolin.wang, npache, ryan.roberts, dev.jain, baohua, lance.yang,
Li Wang
On 12 Mar 2026, at 7:40, Chunyu Hu wrote:
> When thp is not available, just skip the collape tests to avoid the false
> positive.
>
> Without the change, run with a thp disabled kernel:
> ./run_vmtests.sh -t madv_guard
> <snip/>
> # # RUN guard_regions.file.multi_vma ...
> # # OK guard_regions.file.multi_vma
> # ok 89 guard_regions.file.multi_vma
> # # RUN guard_regions.file.basic ...
> # # OK guard_regions.file.basic
> # ok 90 guard_regions.file.basic
> # # FAILED: 87 / 90 tests passed.
> # # 17 skipped test(s) detected. Consider enabling relevant config options to improve coverage.
> # # Totals: pass:70 fail:3 xfail:0 xpass:0 skip:17 error:0
> # [FAIL]
> not ok 1 guard-regions # exit=1
> hwpoison_inject
> # SUMMARY: PASS=0 SKIP=0 FAIL=1
>
> With this change, run with thp disabled kernel:
> ./run_vmtests.sh -t madv_guard
> <snip/>
> # ok 90 guard_regions.file.basic
> # # PASSED: 90 / 90 tests passed.
> # # 20 skipped test(s) detected. Consider enabling relevant config options to improve coverage.
> # # Totals: pass:70 fail:0 xfail:0 xpass:0 skip:20 error:0
> # [PASS]
> ok 1 guard-regions
> hwpoison_inject
> # SUMMARY: PASS=1 SKIP=0 FAIL=0
> 1..1
> CC: Li Wang <liwang@redhat.com>
> Signed-off-by: Chunyu Hu <chuhu@redhat.com>
> ---
> tools/testing/selftests/mm/guard-regions.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
LGTM.
Reviewed-by: Zi Yan <ziy@nvidia.com>
Best Regards,
Yan, Zi
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [RESEND PATCH 2/4] selftests/mm: soft-dirty: skip two tests when thp is not available
2026-03-12 11:40 ` [RESEND PATCH 2/4] selftests/mm: soft-dirty: skip two tests when thp is not available Chunyu Hu
@ 2026-03-12 14:00 ` Zi Yan
2026-03-12 19:43 ` David Hildenbrand (Arm)
2026-03-13 17:37 ` Lorenzo Stoakes (Oracle)
2 siblings, 0 replies; 34+ messages in thread
From: Zi Yan @ 2026-03-12 14:00 UTC (permalink / raw)
To: Chunyu Hu
Cc: akpm, david, shuah, linux-mm, ljs, linux-kselftest, linux-kernel,
lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb, mhocko,
baolin.wang, npache, ryan.roberts, dev.jain, baohua, lance.yang,
Li Wang
On 12 Mar 2026, at 7:40, Chunyu Hu wrote:
> The test_hugepage test contain two sub tests. If just reporting one skip
> when thp not available, there will be error in the log because the test
> count don't match the test plan. Change to skip two tests by running the
> ksft_test_result_skip twice in this case.
>
> Without the fix (run test on thp disabled kernel):
> ./run_vmtests.sh -t soft_dirty
> # --------------------
> # running ./soft-dirty
> # --------------------
> # TAP version 13
> # 1..19
> # ok 1 Test test_simple
> # ok 2 Test test_vma_reuse dirty bit of allocated page
> # ok 3 Test test_vma_reuse dirty bit of reused address page
> # ok 4 # SKIP Transparent Hugepages not available
> # ok 5 Test test_mprotect-anon dirty bit of new written page
> # ok 6 Test test_mprotect-anon soft-dirty clear after clear_refs
> # ok 7 Test test_mprotect-anon soft-dirty clear after marking RO
> # ok 8 Test test_mprotect-anon soft-dirty clear after marking RW
> # ok 9 Test test_mprotect-anon soft-dirty after rewritten
> # ok 10 Test test_mprotect-file dirty bit of new written page
> # ok 11 Test test_mprotect-file soft-dirty clear after clear_refs
> # ok 12 Test test_mprotect-file soft-dirty clear after marking RO
> # ok 13 Test test_mprotect-file soft-dirty clear after marking RW
> # ok 14 Test test_mprotect-file soft-dirty after rewritten
> # ok 15 Test test_merge-anon soft-dirty after remap merge 1st pg
> # ok 16 Test test_merge-anon soft-dirty after remap merge 2nd pg
> # ok 17 Test test_merge-anon soft-dirty after mprotect merge 1st pg
> # ok 18 Test test_merge-anon soft-dirty after mprotect merge 2nd pg
> # # 1 skipped test(s) detected. Consider enabling relevant config options to improve coverage.
> # # Planned tests != run tests (19 != 18)
> # # Totals: pass:17 fail:0 xfail:0 xpass:0 skip:1 error:0
> # [FAIL]
> not ok 52 soft-dirty # exit=1
>
> With the fix (run test on thp disabled kernel):
> ./run_vmtests.sh -t soft_dirty
> # --------------------
> # running ./soft-dirty
> # TAP version 13
> # --------------------
> # running ./soft-dirty
> # --------------------
> # TAP version 13
> # 1..19
> # ok 1 Test test_simple
> # ok 2 Test test_vma_reuse dirty bit of allocated page
> # ok 3 Test test_vma_reuse dirty bit of reused address page
> # # Transparent Hugepages not available
> # ok 4 # SKIP Test test_hugepage huge page allocation
> # ok 5 # SKIP Test test_hugepage huge page dirty bit
> # ok 6 Test test_mprotect-anon dirty bit of new written page
> # ok 7 Test test_mprotect-anon soft-dirty clear after clear_refs
> # ok 8 Test test_mprotect-anon soft-dirty clear after marking RO
> # ok 9 Test test_mprotect-anon soft-dirty clear after marking RW
> # ok 10 Test test_mprotect-anon soft-dirty after rewritten
> # ok 11 Test test_mprotect-file dirty bit of new written page
> # ok 12 Test test_mprotect-file soft-dirty clear after clear_refs
> # ok 13 Test test_mprotect-file soft-dirty clear after marking RO
> # ok 14 Test test_mprotect-file soft-dirty clear after marking RW
> # ok 15 Test test_mprotect-file soft-dirty after rewritten
> # ok 16 Test test_merge-anon soft-dirty after remap merge 1st pg
> # ok 17 Test test_merge-anon soft-dirty after remap merge 2nd pg
> # ok 18 Test test_merge-anon soft-dirty after mprotect merge 1st pg
> # ok 19 Test test_merge-anon soft-dirty after mprotect merge 2nd pg
> # # 2 skipped test(s) detected. Consider enabling relevant config options to improve coverage.
> # # Totals: pass:17 fail:0 xfail:0 xpass:0 skip:2 error:0
> # [PASS]
> ok 1 soft-dirty
> hwpoison_inject
> # SUMMARY: PASS=1 SKIP=0 FAIL=0
> 1..1
> CC: Li Wang <liwang@redhat.com>
> Signed-off-by: Chunyu Hu <chuhu@redhat.com>
> ---
> tools/testing/selftests/mm/soft-dirty.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
LGTM.
Reviewed-by: Zi Yan <ziy@nvidia.com>
Best Regards,
Yan, Zi
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 0/4] selftests/mm: skip several tests when thp is not available
2026-03-12 11:40 [PATCH 0/4] selftests/mm: skip several tests when thp is not available Chunyu Hu
` (3 preceding siblings ...)
2026-03-12 11:40 ` [RESEND PATCH 4/4] selftests/mm: transhuge_stress: skip the test when thp " Chunyu Hu
@ 2026-03-12 14:03 ` Mike Rapoport
2026-03-13 0:26 ` Chunyu Hu
2026-03-12 19:39 ` David Hildenbrand (Arm)
5 siblings, 1 reply; 34+ messages in thread
From: Mike Rapoport @ 2026-03-12 14:03 UTC (permalink / raw)
To: Chunyu Hu
Cc: akpm, david, shuah, linux-mm, ljs, linux-kselftest, linux-kernel,
lorenzo.stoakes, Liam.Howlett, vbabka, surenb, mhocko, ziy,
baolin.wang, npache, ryan.roberts, dev.jain, baohua, lance.yang
On Thu, Mar 12, 2026 at 07:40:23PM +0800, Chunyu Hu wrote:
> There are several tests requires transprarent hugepages, when run on thp
> disabled kernel such as realtime kernel, there will be false positve.
I presume that when THP tests run on kernels with THP disabled they fail
and it would be a false negative rather than false positive.
> Mark those tests as skip when thp is not available.
>
> Chunye Hu (4):
> selftests/mm/guard-regions: skip collapse test when thp not enabled
> selftests/mm: soft-dirty: skip two tests when thp not available
> selftests/mm: split_huge_page_test: skip the test when thp not
> available
> selftests/mm: transhuge_stress: skip the test when thp not available
>
> tools/testing/selftests/mm/guard-regions.c | 4 ++++
> tools/testing/selftests/mm/soft-dirty.c | 4 +++-
> tools/testing/selftests/mm/split_huge_page_test.c | 9 +++++++--
> tools/testing/selftests/mm/transhuge-stress.c | 4 ++++
> 4 files changed, 18 insertions(+), 3 deletions(-)
>
>
> base-commit: 80234b5ab240f52fa45d201e899e207b9265ef91
> --
> 2.53.0
>
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [RESEND PATCH 3/4] selftests/mm: split_huge_page_test: skip the test when thp is not available
2026-03-12 11:40 ` [RESEND PATCH 3/4] selftests/mm: split_huge_page_test: skip the test " Chunyu Hu
@ 2026-03-12 14:11 ` Zi Yan
2026-03-13 2:29 ` Chunyu Hu
2026-03-13 15:15 ` Mike Rapoport
2026-03-12 19:44 ` David Hildenbrand (Arm)
1 sibling, 2 replies; 34+ messages in thread
From: Zi Yan @ 2026-03-12 14:11 UTC (permalink / raw)
To: Chunyu Hu
Cc: akpm, david, shuah, linux-mm, ljs, linux-kselftest, linux-kernel,
lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb, mhocko,
baolin.wang, npache, ryan.roberts, dev.jain, baohua, lance.yang,
Li Wang
On 12 Mar 2026, at 7:40, Chunyu Hu wrote:
> When thp is not enabled on some kernel config such as realtime kernel, the
> test will report failure. Fix the false positive by skipping the test
> directly when thp is not enabled.
>
> There's a naming conflict on write_file() function, both thp_settings.h and
> split_huge_page_test.c define it. To make use of thp_is_enabled() helper in
> the thp_settings.h, rename this local write_file to safe_write_file to
> avoid the conflict. The reason to use 'safe_' is it does some error check.
Both write_file() do safe checks. Actually the code of both functions looks
almost identical except that the thp_settings one does exit() instead of
ksft_exit_fail_msg().
Can you rename the split_huge_page_test’s write_file() to write_file_local()
and add a comment above the function like
/* add _local to avoid a function conflict with thp_settings.h */?
With that, feel free to add:
Reviewed-by: Zi Yan <ziy@nvidia.com>
Thanks.
>
> Tested with thp disabled kernel:
> Before The fix:
> # --------------------------------------------------
> # running ./split_huge_page_test /tmp/xfs_dir_Ywup9p
> # --------------------------------------------------
> # TAP version 13
> # Bail out! Reading PMD pagesize failed
> # # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:0 error:0
> # [FAIL]
> not ok 61 split_huge_page_test /tmp/xfs_dir_Ywup9p # exit=1
>
> After the fix:
> # --------------------------------------------------
> # running ./split_huge_page_test /tmp/xfs_dir_YHPUPl
> # --------------------------------------------------
> # TAP version 13
> # 1..0 # SKIP Transparent Hugepages not available
> # [SKIP]
> ok 6 split_huge_page_test /tmp/xfs_dir_YHPUPl # SKIP
>
> CC: Li Wang <liwang@redhat.com>
> Signed-off-by: Chunyu Hu <chuhu@redhat.com>
> ---
> tools/testing/selftests/mm/split_huge_page_test.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/mm/split_huge_page_test.c b/tools/testing/selftests/mm/split_huge_page_test.c
> index e0167111bdd1..615b75ca62cc 100644
> --- a/tools/testing/selftests/mm/split_huge_page_test.c
> +++ b/tools/testing/selftests/mm/split_huge_page_test.c
> @@ -21,6 +21,7 @@
> #include <time.h>
> #include "vm_util.h"
> #include "kselftest.h"
> +#include "thp_settings.h"
>
> uint64_t pagesize;
> unsigned int pageshift;
> @@ -255,7 +256,7 @@ static int check_after_split_folio_orders(char *vaddr_start, size_t len,
> return status;
> }
>
> -static void write_file(const char *path, const char *buf, size_t buflen)
> +static void safe_write_file(const char *path, const char *buf, size_t buflen)
> {
> int fd;
> ssize_t numwritten;
> @@ -283,7 +284,7 @@ static void write_debugfs(const char *fmt, ...)
> if (ret >= INPUT_MAX)
> ksft_exit_fail_msg("%s: Debugfs input is too long\n", __func__);
>
> - write_file(SPLIT_DEBUGFS, input, ret + 1);
> + safe_write_file(SPLIT_DEBUGFS, input, ret + 1);
> }
>
> static char *allocate_zero_filled_hugepage(size_t len)
> @@ -772,6 +773,10 @@ int main(int argc, char **argv)
> ksft_finished();
> }
>
> + if (!thp_is_enabled()) {
> + ksft_exit_skip("Transparent Hugepages not available\n");
> + }
> +
> if (argc > 1)
> optional_xfs_path = argv[1];
>
> --
> 2.53.0
Best Regards,
Yan, Zi
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [RESEND PATCH 4/4] selftests/mm: transhuge_stress: skip the test when thp not available
2026-03-12 11:40 ` [RESEND PATCH 4/4] selftests/mm: transhuge_stress: skip the test when thp " Chunyu Hu
@ 2026-03-12 14:11 ` Zi Yan
2026-03-12 19:46 ` David Hildenbrand (Arm)
1 sibling, 0 replies; 34+ messages in thread
From: Zi Yan @ 2026-03-12 14:11 UTC (permalink / raw)
To: Chunyu Hu
Cc: akpm, david, shuah, linux-mm, ljs, linux-kselftest, linux-kernel,
lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb, mhocko,
baolin.wang, npache, ryan.roberts, dev.jain, baohua, lance.yang,
Li Wang
On 12 Mar 2026, at 7:40, Chunyu Hu wrote:
> The test requires thp, skip the test when thp is not available to avoid
> false positive.
>
> Tested with thp disabled kernel.
> Before the fix:
> # --------------------------------
> # running ./transhuge-stress -d 20
> # --------------------------------
> # TAP version 13
> # 1..1
> # transhuge-stress: allocate 1453 transhuge pages, using 2907 MiB virtual memory and 11 MiB of ram
> # Bail out! MADV_HUGEPAGE# Planned tests != run tests (1 != 0)
> # # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:0 error:0
> # [FAIL]
> not ok 60 transhuge-stress -d 20 # exit=1
>
> After the fix:
> # --------------------------------
> # running ./transhuge-stress -d 20
> # --------------------------------
> # 1..0 # SKIP Transparent Hugepages not available
> # [SKIP]
> ok 5 transhuge-stress -d 20 # SKIP
>
> CC: Li Wang <liwang@redhat.com>
> Signed-off-by: Chunyu Hu <chuhu@redhat.com>
> ---
> tools/testing/selftests/mm/transhuge-stress.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
LGTM.
Reviewed-by: Zi Yan <ziy@nvidia.com>
Best Regards,
Yan, Zi
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 0/4] selftests/mm: skip several tests when thp is not available
2026-03-12 11:40 [PATCH 0/4] selftests/mm: skip several tests when thp is not available Chunyu Hu
` (4 preceding siblings ...)
2026-03-12 14:03 ` [PATCH 0/4] selftests/mm: skip several tests when thp is " Mike Rapoport
@ 2026-03-12 19:39 ` David Hildenbrand (Arm)
2026-03-13 2:21 ` Chunyu Hu
5 siblings, 1 reply; 34+ messages in thread
From: David Hildenbrand (Arm) @ 2026-03-12 19:39 UTC (permalink / raw)
To: Chunyu Hu, akpm, shuah, linux-mm, ljs
Cc: linux-kselftest, linux-kernel, lorenzo.stoakes, Liam.Howlett,
vbabka, rppt, surenb, mhocko, ziy, baolin.wang, npache,
ryan.roberts, dev.jain, baohua, lance.yang
On 3/12/26 12:40, Chunyu Hu wrote:
> There are several tests requires transprarent hugepages, when run on thp
> disabled kernel such as realtime kernel, there will be false positve.
> Mark those tests as skip when thp is not available.
We expend that people that run the tests have the configs as contained in
tools/testing/selftests/mm/config
enabled.
I'm fine with teaching the tests that that is no longer required.
Should we then remove
CONFIG_TRANSPARENT_HUGEPAGE=y
from the file, or leave it in there for people building their configs to
know what to enable for best test coverage? (I doubt people do use it
for that purpose)
--
Cheers,
David
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [RESEND PATCH 2/4] selftests/mm: soft-dirty: skip two tests when thp is not available
2026-03-12 11:40 ` [RESEND PATCH 2/4] selftests/mm: soft-dirty: skip two tests when thp is not available Chunyu Hu
2026-03-12 14:00 ` Zi Yan
@ 2026-03-12 19:43 ` David Hildenbrand (Arm)
2026-03-13 17:37 ` Lorenzo Stoakes (Oracle)
2 siblings, 0 replies; 34+ messages in thread
From: David Hildenbrand (Arm) @ 2026-03-12 19:43 UTC (permalink / raw)
To: Chunyu Hu, akpm, shuah, linux-mm, ljs
Cc: linux-kselftest, linux-kernel, lorenzo.stoakes, Liam.Howlett,
vbabka, rppt, surenb, mhocko, ziy, baolin.wang, npache,
ryan.roberts, dev.jain, baohua, lance.yang, Li Wang
On 3/12/26 12:40, Chunyu Hu wrote:
> The test_hugepage test contain two sub tests. If just reporting one skip
> when thp not available, there will be error in the log because the test
> count don't match the test plan. Change to skip two tests by running the
> ksft_test_result_skip twice in this case.
>
> Without the fix (run test on thp disabled kernel):
> ./run_vmtests.sh -t soft_dirty
> # --------------------
> # running ./soft-dirty
> # --------------------
> # TAP version 13
> # 1..19
> # ok 1 Test test_simple
> # ok 2 Test test_vma_reuse dirty bit of allocated page
> # ok 3 Test test_vma_reuse dirty bit of reused address page
> # ok 4 # SKIP Transparent Hugepages not available
> # ok 5 Test test_mprotect-anon dirty bit of new written page
> # ok 6 Test test_mprotect-anon soft-dirty clear after clear_refs
> # ok 7 Test test_mprotect-anon soft-dirty clear after marking RO
> # ok 8 Test test_mprotect-anon soft-dirty clear after marking RW
> # ok 9 Test test_mprotect-anon soft-dirty after rewritten
> # ok 10 Test test_mprotect-file dirty bit of new written page
> # ok 11 Test test_mprotect-file soft-dirty clear after clear_refs
> # ok 12 Test test_mprotect-file soft-dirty clear after marking RO
> # ok 13 Test test_mprotect-file soft-dirty clear after marking RW
> # ok 14 Test test_mprotect-file soft-dirty after rewritten
> # ok 15 Test test_merge-anon soft-dirty after remap merge 1st pg
> # ok 16 Test test_merge-anon soft-dirty after remap merge 2nd pg
> # ok 17 Test test_merge-anon soft-dirty after mprotect merge 1st pg
> # ok 18 Test test_merge-anon soft-dirty after mprotect merge 2nd pg
> # # 1 skipped test(s) detected. Consider enabling relevant config options to improve coverage.
> # # Planned tests != run tests (19 != 18)
> # # Totals: pass:17 fail:0 xfail:0 xpass:0 skip:1 error:0
> # [FAIL]
> not ok 52 soft-dirty # exit=1
>
> With the fix (run test on thp disabled kernel):
> ./run_vmtests.sh -t soft_dirty
> # --------------------
> # running ./soft-dirty
> # TAP version 13
> # --------------------
> # running ./soft-dirty
> # --------------------
> # TAP version 13
> # 1..19
> # ok 1 Test test_simple
> # ok 2 Test test_vma_reuse dirty bit of allocated page
> # ok 3 Test test_vma_reuse dirty bit of reused address page
> # # Transparent Hugepages not available
> # ok 4 # SKIP Test test_hugepage huge page allocation
> # ok 5 # SKIP Test test_hugepage huge page dirty bit
> # ok 6 Test test_mprotect-anon dirty bit of new written page
> # ok 7 Test test_mprotect-anon soft-dirty clear after clear_refs
> # ok 8 Test test_mprotect-anon soft-dirty clear after marking RO
> # ok 9 Test test_mprotect-anon soft-dirty clear after marking RW
> # ok 10 Test test_mprotect-anon soft-dirty after rewritten
> # ok 11 Test test_mprotect-file dirty bit of new written page
> # ok 12 Test test_mprotect-file soft-dirty clear after clear_refs
> # ok 13 Test test_mprotect-file soft-dirty clear after marking RO
> # ok 14 Test test_mprotect-file soft-dirty clear after marking RW
> # ok 15 Test test_mprotect-file soft-dirty after rewritten
> # ok 16 Test test_merge-anon soft-dirty after remap merge 1st pg
> # ok 17 Test test_merge-anon soft-dirty after remap merge 2nd pg
> # ok 18 Test test_merge-anon soft-dirty after mprotect merge 1st pg
> # ok 19 Test test_merge-anon soft-dirty after mprotect merge 2nd pg
> # # 2 skipped test(s) detected. Consider enabling relevant config options to improve coverage.
> # # Totals: pass:17 fail:0 xfail:0 xpass:0 skip:2 error:0
> # [PASS]
> ok 1 soft-dirty
> hwpoison_inject
> # SUMMARY: PASS=1 SKIP=0 FAIL=0
> 1..1
> CC: Li Wang <liwang@redhat.com>
> Signed-off-by: Chunyu Hu <chuhu@redhat.com>
> ---
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
--
Cheers,
David
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [RESEND PATCH 3/4] selftests/mm: split_huge_page_test: skip the test when thp is not available
2026-03-12 11:40 ` [RESEND PATCH 3/4] selftests/mm: split_huge_page_test: skip the test " Chunyu Hu
2026-03-12 14:11 ` Zi Yan
@ 2026-03-12 19:44 ` David Hildenbrand (Arm)
2026-03-13 2:25 ` Chunyu Hu
1 sibling, 1 reply; 34+ messages in thread
From: David Hildenbrand (Arm) @ 2026-03-12 19:44 UTC (permalink / raw)
To: Chunyu Hu, akpm, shuah, linux-mm, ljs
Cc: linux-kselftest, linux-kernel, lorenzo.stoakes, Liam.Howlett,
vbabka, rppt, surenb, mhocko, ziy, baolin.wang, npache,
ryan.roberts, dev.jain, baohua, lance.yang, Li Wang
>
> + if (!thp_is_enabled()) {
> + ksft_exit_skip("Transparent Hugepages not available\n");
> + }
> +
No need for the {}
--
Cheers,
David
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [RESEND PATCH 4/4] selftests/mm: transhuge_stress: skip the test when thp not available
2026-03-12 11:40 ` [RESEND PATCH 4/4] selftests/mm: transhuge_stress: skip the test when thp " Chunyu Hu
2026-03-12 14:11 ` Zi Yan
@ 2026-03-12 19:46 ` David Hildenbrand (Arm)
2026-03-13 2:43 ` Chunyu Hu
1 sibling, 1 reply; 34+ messages in thread
From: David Hildenbrand (Arm) @ 2026-03-12 19:46 UTC (permalink / raw)
To: Chunyu Hu, akpm, shuah, linux-mm, ljs
Cc: linux-kselftest, linux-kernel, lorenzo.stoakes, Liam.Howlett,
vbabka, rppt, surenb, mhocko, ziy, baolin.wang, npache,
ryan.roberts, dev.jain, baohua, lance.yang, Li Wang
On 3/12/26 12:40, Chunyu Hu wrote:
> The test requires thp, skip the test when thp is not available to avoid
> false positive.
>
> Tested with thp disabled kernel.
> Before the fix:
> # --------------------------------
> # running ./transhuge-stress -d 20
> # --------------------------------
> # TAP version 13
> # 1..1
> # transhuge-stress: allocate 1453 transhuge pages, using 2907 MiB virtual memory and 11 MiB of ram
> # Bail out! MADV_HUGEPAGE# Planned tests != run tests (1 != 0)
> # # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:0 error:0
> # [FAIL]
> not ok 60 transhuge-stress -d 20 # exit=1
>
> After the fix:
> # --------------------------------
> # running ./transhuge-stress -d 20
> # --------------------------------
> # 1..0 # SKIP Transparent Hugepages not available
> # [SKIP]
> ok 5 transhuge-stress -d 20 # SKIP
>
> CC: Li Wang <liwang@redhat.com>
> Signed-off-by: Chunyu Hu <chuhu@redhat.com>
> ---
> tools/testing/selftests/mm/transhuge-stress.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/tools/testing/selftests/mm/transhuge-stress.c b/tools/testing/selftests/mm/transhuge-stress.c
> index bcad47c09518..76316696426d 100644
> --- a/tools/testing/selftests/mm/transhuge-stress.c
> +++ b/tools/testing/selftests/mm/transhuge-stress.c
> @@ -17,6 +17,7 @@
> #include <sys/mman.h>
> #include "vm_util.h"
> #include "kselftest.h"
> +#include "thp_settings.h"
>
> int backing_fd = -1;
> int mmap_flags = MAP_ANONYMOUS | MAP_NORESERVE | MAP_PRIVATE;
> @@ -35,6 +36,9 @@ int main(int argc, char **argv)
> int pagemap_fd;
> int duration = 0;
>
> + if (!thp_is_enabled())
> + ksft_exit_skip("Transparent Hugepages not available\n");
> +
> ksft_print_header();
Shouldn't that go under the ksft_print_header(), like you did in patch #3?
--
Cheers,
David
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [RESEND PATCH 1/4] selftests/mm/guard-regions: skip collapse test when thp not enabled
2026-03-12 11:40 ` [RESEND PATCH 1/4] selftests/mm/guard-regions: skip collapse test when thp not enabled Chunyu Hu
2026-03-12 13:58 ` Zi Yan
@ 2026-03-12 19:48 ` David Hildenbrand (Arm)
2026-03-13 15:35 ` Lorenzo Stoakes (Oracle)
2 siblings, 0 replies; 34+ messages in thread
From: David Hildenbrand (Arm) @ 2026-03-12 19:48 UTC (permalink / raw)
To: Chunyu Hu, akpm, shuah, linux-mm, ljs
Cc: linux-kselftest, linux-kernel, lorenzo.stoakes, Liam.Howlett,
vbabka, rppt, surenb, mhocko, ziy, baolin.wang, npache,
ryan.roberts, dev.jain, baohua, lance.yang, Li Wang
On 3/12/26 12:40, Chunyu Hu wrote:
> When thp is not available, just skip the collape tests to avoid the false
> positive.
>
> Without the change, run with a thp disabled kernel:
> ./run_vmtests.sh -t madv_guard
> <snip/>
> # # RUN guard_regions.file.multi_vma ...
> # # OK guard_regions.file.multi_vma
> # ok 89 guard_regions.file.multi_vma
> # # RUN guard_regions.file.basic ...
> # # OK guard_regions.file.basic
> # ok 90 guard_regions.file.basic
> # # FAILED: 87 / 90 tests passed.
> # # 17 skipped test(s) detected. Consider enabling relevant config options to improve coverage.
> # # Totals: pass:70 fail:3 xfail:0 xpass:0 skip:17 error:0
> # [FAIL]
> not ok 1 guard-regions # exit=1
> hwpoison_inject
> # SUMMARY: PASS=0 SKIP=0 FAIL=1
>
> With this change, run with thp disabled kernel:
> ./run_vmtests.sh -t madv_guard
> <snip/>
> # ok 90 guard_regions.file.basic
> # # PASSED: 90 / 90 tests passed.
> # # 20 skipped test(s) detected. Consider enabling relevant config options to improve coverage.
> # # Totals: pass:70 fail:0 xfail:0 xpass:0 skip:20 error:0
> # [PASS]
> ok 1 guard-regions
> hwpoison_inject
> # SUMMARY: PASS=1 SKIP=0 FAIL=0
> 1..1
> CC: Li Wang <liwang@redhat.com>
> Signed-off-by: Chunyu Hu <chuhu@redhat.com>
> ---
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
--
Cheers,
David
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 0/4] selftests/mm: skip several tests when thp is not available
2026-03-12 14:03 ` [PATCH 0/4] selftests/mm: skip several tests when thp is " Mike Rapoport
@ 2026-03-13 0:26 ` Chunyu Hu
2026-03-13 15:19 ` Mike Rapoport
0 siblings, 1 reply; 34+ messages in thread
From: Chunyu Hu @ 2026-03-13 0:26 UTC (permalink / raw)
To: Mike Rapoport
Cc: akpm, david, shuah, linux-mm, ljs, linux-kselftest, linux-kernel,
lorenzo.stoakes, Liam.Howlett, vbabka, surenb, mhocko, ziy,
baolin.wang, npache, ryan.roberts, dev.jain, baohua, lance.yang
On Thu, Mar 12, 2026 at 04:03:59PM +0200, Mike Rapoport wrote:
> On Thu, Mar 12, 2026 at 07:40:23PM +0800, Chunyu Hu wrote:
> > There are several tests requires transprarent hugepages, when run on thp
> > disabled kernel such as realtime kernel, there will be false positve.
>
> I presume that when THP tests run on kernels with THP disabled they fail
> and it would be a false negative rather than false positive.
This is an interesting point. I'm not naitive speaker. I just learned
from AI. It really matters what we define as 'postive'. I presume 'postive'
is we run selftest and got a failure report, that's postive, not thinking
as it's thp disabled kernel and a 'pass' is postive.
I'll add statement about 'postive' in v2 like "a test failure is
defiend as postive"
>
> > Mark those tests as skip when thp is not available.
> >
> > Chunye Hu (4):
> > selftests/mm/guard-regions: skip collapse test when thp not enabled
> > selftests/mm: soft-dirty: skip two tests when thp not available
> > selftests/mm: split_huge_page_test: skip the test when thp not
> > available
> > selftests/mm: transhuge_stress: skip the test when thp not available
> >
> > tools/testing/selftests/mm/guard-regions.c | 4 ++++
> > tools/testing/selftests/mm/soft-dirty.c | 4 +++-
> > tools/testing/selftests/mm/split_huge_page_test.c | 9 +++++++--
> > tools/testing/selftests/mm/transhuge-stress.c | 4 ++++
> > 4 files changed, 18 insertions(+), 3 deletions(-)
> >
> >
> > base-commit: 80234b5ab240f52fa45d201e899e207b9265ef91
> > --
> > 2.53.0
> >
>
> --
> Sincerely yours,
> Mike.
>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 0/4] selftests/mm: skip several tests when thp is not available
2026-03-12 19:39 ` David Hildenbrand (Arm)
@ 2026-03-13 2:21 ` Chunyu Hu
0 siblings, 0 replies; 34+ messages in thread
From: Chunyu Hu @ 2026-03-13 2:21 UTC (permalink / raw)
To: David Hildenbrand (Arm)
Cc: akpm, shuah, linux-mm, ljs, linux-kselftest, linux-kernel,
lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb, mhocko, ziy,
baolin.wang, npache, ryan.roberts, dev.jain, baohua, lance.yang
On Thu, Mar 12, 2026 at 08:39:31PM +0100, David Hildenbrand (Arm) wrote:
> On 3/12/26 12:40, Chunyu Hu wrote:
> > There are several tests requires transprarent hugepages, when run on thp
> > disabled kernel such as realtime kernel, there will be false positve.
> > Mark those tests as skip when thp is not available.
>
> We expend that people that run the tests have the configs as contained in
>
> tools/testing/selftests/mm/config
I didn't notice we have such as file. It's a good template for people to
refer to. We can see in the test log when some tests are skipped:
'skipped test(s) detected. Consider enabling relevant config options to
improve coverage.'
Then this template is helpful for user to 'enable relevant config' when
they building kernle themself. But some users just run the default product
kernel which is a pre-compiled kernel with product config.
>
> enabled.
>
> I'm fine with teaching the tests that that is no longer required.
>
> Should we then remove
>
> CONFIG_TRANSPARENT_HUGEPAGE=y
>
> from the file, or leave it in there for people building their configs to
> know what to enable for best test coverage? (I doubt people do use it
> for that purpose)
The config template is good for people to getting better coverage. Maybe we
leave it there, and point people to this config template in the log when some
tests are skipped due to kernel config. And yes, user may not do this
and they want to detect issue in there product config.
'skipped test(s) detected. Consider enabling relevant config options to
improve coverage. See selftests/mm/config.'
I find the commit that introduced this config template. And there's a guide
in the commit message that about how to merge the config.
'8c749ce93ee6 selftests: create test-specific kconfig fragments'
>
> --
> Cheers,
>
> David
>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [RESEND PATCH 3/4] selftests/mm: split_huge_page_test: skip the test when thp is not available
2026-03-12 19:44 ` David Hildenbrand (Arm)
@ 2026-03-13 2:25 ` Chunyu Hu
0 siblings, 0 replies; 34+ messages in thread
From: Chunyu Hu @ 2026-03-13 2:25 UTC (permalink / raw)
To: David Hildenbrand (Arm)
Cc: akpm, shuah, linux-mm, ljs, linux-kselftest, linux-kernel,
lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb, mhocko, ziy,
baolin.wang, npache, ryan.roberts, dev.jain, baohua, lance.yang,
Li Wang
On Thu, Mar 12, 2026 at 08:44:46PM +0100, David Hildenbrand (Arm) wrote:
>
> >
> > + if (!thp_is_enabled()) {
> > + ksft_exit_skip("Transparent Hugepages not available\n");
> > + }
> > +
>
> No need for the {}
Oops, my bad. I overlooked it when checking patch. Will fix in v2.
>
> --
> Cheers,
>
> David
>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [RESEND PATCH 3/4] selftests/mm: split_huge_page_test: skip the test when thp is not available
2026-03-12 14:11 ` Zi Yan
@ 2026-03-13 2:29 ` Chunyu Hu
2026-03-13 15:15 ` Mike Rapoport
1 sibling, 0 replies; 34+ messages in thread
From: Chunyu Hu @ 2026-03-13 2:29 UTC (permalink / raw)
To: Zi Yan
Cc: akpm, david, shuah, linux-mm, ljs, linux-kselftest, linux-kernel,
lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb, mhocko,
baolin.wang, npache, ryan.roberts, dev.jain, baohua, lance.yang,
Li Wang
On Thu, Mar 12, 2026 at 10:11:12AM -0400, Zi Yan wrote:
> On 12 Mar 2026, at 7:40, Chunyu Hu wrote:
>
> > When thp is not enabled on some kernel config such as realtime kernel, the
> > test will report failure. Fix the false positive by skipping the test
> > directly when thp is not enabled.
> >
> > There's a naming conflict on write_file() function, both thp_settings.h and
> > split_huge_page_test.c define it. To make use of thp_is_enabled() helper in
> > the thp_settings.h, rename this local write_file to safe_write_file to
> > avoid the conflict. The reason to use 'safe_' is it does some error check.
>
> Both write_file() do safe checks. Actually the code of both functions looks
> almost identical except that the thp_settings one does exit() instead of
> ksft_exit_fail_msg().
indeed.
>
> Can you rename the split_huge_page_test’s write_file() to write_file_local()
> and add a comment above the function like
> /* add _local to avoid a function conflict with thp_settings.h */?
Good point. I'll add that in the v2.
>
> With that, feel free to add:
>
> Reviewed-by: Zi Yan <ziy@nvidia.com>
Thank you for the rewview. Will add.
>
> Thanks.
>
> >
> > Tested with thp disabled kernel:
> > Before The fix:
> > # --------------------------------------------------
> > # running ./split_huge_page_test /tmp/xfs_dir_Ywup9p
> > # --------------------------------------------------
> > # TAP version 13
> > # Bail out! Reading PMD pagesize failed
> > # # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:0 error:0
> > # [FAIL]
> > not ok 61 split_huge_page_test /tmp/xfs_dir_Ywup9p # exit=1
> >
> > After the fix:
> > # --------------------------------------------------
> > # running ./split_huge_page_test /tmp/xfs_dir_YHPUPl
> > # --------------------------------------------------
> > # TAP version 13
> > # 1..0 # SKIP Transparent Hugepages not available
> > # [SKIP]
> > ok 6 split_huge_page_test /tmp/xfs_dir_YHPUPl # SKIP
> >
> > CC: Li Wang <liwang@redhat.com>
> > Signed-off-by: Chunyu Hu <chuhu@redhat.com>
> > ---
> > tools/testing/selftests/mm/split_huge_page_test.c | 9 +++++++--
> > 1 file changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/testing/selftests/mm/split_huge_page_test.c b/tools/testing/selftests/mm/split_huge_page_test.c
> > index e0167111bdd1..615b75ca62cc 100644
> > --- a/tools/testing/selftests/mm/split_huge_page_test.c
> > +++ b/tools/testing/selftests/mm/split_huge_page_test.c
> > @@ -21,6 +21,7 @@
> > #include <time.h>
> > #include "vm_util.h"
> > #include "kselftest.h"
> > +#include "thp_settings.h"
> >
> > uint64_t pagesize;
> > unsigned int pageshift;
> > @@ -255,7 +256,7 @@ static int check_after_split_folio_orders(char *vaddr_start, size_t len,
> > return status;
> > }
> >
> > -static void write_file(const char *path, const char *buf, size_t buflen)
> > +static void safe_write_file(const char *path, const char *buf, size_t buflen)
> > {
> > int fd;
> > ssize_t numwritten;
> > @@ -283,7 +284,7 @@ static void write_debugfs(const char *fmt, ...)
> > if (ret >= INPUT_MAX)
> > ksft_exit_fail_msg("%s: Debugfs input is too long\n", __func__);
> >
> > - write_file(SPLIT_DEBUGFS, input, ret + 1);
> > + safe_write_file(SPLIT_DEBUGFS, input, ret + 1);
> > }
> >
> > static char *allocate_zero_filled_hugepage(size_t len)
> > @@ -772,6 +773,10 @@ int main(int argc, char **argv)
> > ksft_finished();
> > }
> >
> > + if (!thp_is_enabled()) {
> > + ksft_exit_skip("Transparent Hugepages not available\n");
> > + }
> > +
> > if (argc > 1)
> > optional_xfs_path = argv[1];
> >
> > --
> > 2.53.0
>
>
> Best Regards,
> Yan, Zi
>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [RESEND PATCH 4/4] selftests/mm: transhuge_stress: skip the test when thp not available
2026-03-12 19:46 ` David Hildenbrand (Arm)
@ 2026-03-13 2:43 ` Chunyu Hu
2026-03-13 18:01 ` Lorenzo Stoakes (Oracle)
0 siblings, 1 reply; 34+ messages in thread
From: Chunyu Hu @ 2026-03-13 2:43 UTC (permalink / raw)
To: David Hildenbrand (Arm)
Cc: akpm, shuah, linux-mm, ljs, linux-kselftest, linux-kernel,
lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb, mhocko, ziy,
baolin.wang, npache, ryan.roberts, dev.jain, baohua, lance.yang,
Li Wang
On Thu, Mar 12, 2026 at 08:46:23PM +0100, David Hildenbrand (Arm) wrote:
> On 3/12/26 12:40, Chunyu Hu wrote:
> > The test requires thp, skip the test when thp is not available to avoid
> > false positive.
> >
> > Tested with thp disabled kernel.
> > Before the fix:
> > # --------------------------------
> > # running ./transhuge-stress -d 20
> > # --------------------------------
> > # TAP version 13
> > # 1..1
> > # transhuge-stress: allocate 1453 transhuge pages, using 2907 MiB virtual memory and 11 MiB of ram
> > # Bail out! MADV_HUGEPAGE# Planned tests != run tests (1 != 0)
> > # # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:0 error:0
> > # [FAIL]
> > not ok 60 transhuge-stress -d 20 # exit=1
> >
> > After the fix:
> > # --------------------------------
> > # running ./transhuge-stress -d 20
> > # --------------------------------
> > # 1..0 # SKIP Transparent Hugepages not available
> > # [SKIP]
> > ok 5 transhuge-stress -d 20 # SKIP
> >
> > CC: Li Wang <liwang@redhat.com>
> > Signed-off-by: Chunyu Hu <chuhu@redhat.com>
> > ---
> > tools/testing/selftests/mm/transhuge-stress.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/tools/testing/selftests/mm/transhuge-stress.c b/tools/testing/selftests/mm/transhuge-stress.c
> > index bcad47c09518..76316696426d 100644
> > --- a/tools/testing/selftests/mm/transhuge-stress.c
> > +++ b/tools/testing/selftests/mm/transhuge-stress.c
> > @@ -17,6 +17,7 @@
> > #include <sys/mman.h>
> > #include "vm_util.h"
> > #include "kselftest.h"
> > +#include "thp_settings.h"
> >
> > int backing_fd = -1;
> > int mmap_flags = MAP_ANONYMOUS | MAP_NORESERVE | MAP_PRIVATE;
> > @@ -35,6 +36,9 @@ int main(int argc, char **argv)
> > int pagemap_fd;
> > int duration = 0;
> >
> > + if (!thp_is_enabled())
> > + ksft_exit_skip("Transparent Hugepages not available\n");
> > +
> > ksft_print_header();
>
> Shouldn't that go under the ksft_print_header(), like you did in patch #3?
It will print the TAP version. I'll change in v2 as you suggested. Thanks!
>
> --
> Cheers,
>
> David
>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [RESEND PATCH 3/4] selftests/mm: split_huge_page_test: skip the test when thp is not available
2026-03-12 14:11 ` Zi Yan
2026-03-13 2:29 ` Chunyu Hu
@ 2026-03-13 15:15 ` Mike Rapoport
2026-03-13 15:27 ` Zi Yan
2026-03-16 3:46 ` Chunyu Hu
1 sibling, 2 replies; 34+ messages in thread
From: Mike Rapoport @ 2026-03-13 15:15 UTC (permalink / raw)
To: Zi Yan
Cc: Chunyu Hu, akpm, david, shuah, linux-mm, ljs, linux-kselftest,
linux-kernel, lorenzo.stoakes, Liam.Howlett, vbabka, surenb,
mhocko, baolin.wang, npache, ryan.roberts, dev.jain, baohua,
lance.yang, Li Wang
On Thu, Mar 12, 2026 at 10:11:12AM -0400, Zi Yan wrote:
> On 12 Mar 2026, at 7:40, Chunyu Hu wrote:
>
> > When thp is not enabled on some kernel config such as realtime kernel, the
> > test will report failure. Fix the false positive by skipping the test
> > directly when thp is not enabled.
> >
> > There's a naming conflict on write_file() function, both thp_settings.h and
> > split_huge_page_test.c define it. To make use of thp_is_enabled() helper in
> > the thp_settings.h, rename this local write_file to safe_write_file to
> > avoid the conflict. The reason to use 'safe_' is it does some error check.
>
> Both write_file() do safe checks. Actually the code of both functions looks
> almost identical except that the thp_settings one does exit() instead of
> ksft_exit_fail_msg().
>
> Can you rename the split_huge_page_test’s write_file() to write_file_local()
> and add a comment above the function like
> /* add _local to avoid a function conflict with thp_settings.h */?
Looks like we can move the version that uses ksft_exit_fail_msg() to
vm_util and drop the other one.
> With that, feel free to add:
>
> Reviewed-by: Zi Yan <ziy@nvidia.com>
>
> Thanks.
>
> >
> > Tested with thp disabled kernel:
> > Before The fix:
> > # --------------------------------------------------
> > # running ./split_huge_page_test /tmp/xfs_dir_Ywup9p
> > # --------------------------------------------------
> > # TAP version 13
> > # Bail out! Reading PMD pagesize failed
> > # # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:0 error:0
> > # [FAIL]
> > not ok 61 split_huge_page_test /tmp/xfs_dir_Ywup9p # exit=1
> >
> > After the fix:
> > # --------------------------------------------------
> > # running ./split_huge_page_test /tmp/xfs_dir_YHPUPl
> > # --------------------------------------------------
> > # TAP version 13
> > # 1..0 # SKIP Transparent Hugepages not available
> > # [SKIP]
> > ok 6 split_huge_page_test /tmp/xfs_dir_YHPUPl # SKIP
> >
> > CC: Li Wang <liwang@redhat.com>
> > Signed-off-by: Chunyu Hu <chuhu@redhat.com>
> > ---
> > tools/testing/selftests/mm/split_huge_page_test.c | 9 +++++++--
> > 1 file changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/testing/selftests/mm/split_huge_page_test.c b/tools/testing/selftests/mm/split_huge_page_test.c
> > index e0167111bdd1..615b75ca62cc 100644
> > --- a/tools/testing/selftests/mm/split_huge_page_test.c
> > +++ b/tools/testing/selftests/mm/split_huge_page_test.c
> > @@ -21,6 +21,7 @@
> > #include <time.h>
> > #include "vm_util.h"
> > #include "kselftest.h"
> > +#include "thp_settings.h"
> >
> > uint64_t pagesize;
> > unsigned int pageshift;
> > @@ -255,7 +256,7 @@ static int check_after_split_folio_orders(char *vaddr_start, size_t len,
> > return status;
> > }
> >
> > -static void write_file(const char *path, const char *buf, size_t buflen)
> > +static void safe_write_file(const char *path, const char *buf, size_t buflen)
> > {
> > int fd;
> > ssize_t numwritten;
> > @@ -283,7 +284,7 @@ static void write_debugfs(const char *fmt, ...)
> > if (ret >= INPUT_MAX)
> > ksft_exit_fail_msg("%s: Debugfs input is too long\n", __func__);
> >
> > - write_file(SPLIT_DEBUGFS, input, ret + 1);
> > + safe_write_file(SPLIT_DEBUGFS, input, ret + 1);
> > }
> >
> > static char *allocate_zero_filled_hugepage(size_t len)
> > @@ -772,6 +773,10 @@ int main(int argc, char **argv)
> > ksft_finished();
> > }
> >
> > + if (!thp_is_enabled()) {
> > + ksft_exit_skip("Transparent Hugepages not available\n");
> > + }
> > +
> > if (argc > 1)
> > optional_xfs_path = argv[1];
> >
> > --
> > 2.53.0
>
>
> Best Regards,
> Yan, Zi
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 0/4] selftests/mm: skip several tests when thp is not available
2026-03-13 0:26 ` Chunyu Hu
@ 2026-03-13 15:19 ` Mike Rapoport
2026-03-13 15:40 ` Lorenzo Stoakes (Oracle)
2026-03-14 0:27 ` Chunyu Hu
0 siblings, 2 replies; 34+ messages in thread
From: Mike Rapoport @ 2026-03-13 15:19 UTC (permalink / raw)
To: Chunyu Hu
Cc: akpm, david, shuah, linux-mm, ljs, linux-kselftest, linux-kernel,
lorenzo.stoakes, Liam.Howlett, vbabka, surenb, mhocko, ziy,
baolin.wang, npache, ryan.roberts, dev.jain, baohua, lance.yang
On Fri, Mar 13, 2026 at 08:26:02AM +0800, Chunyu Hu wrote:
> On Thu, Mar 12, 2026 at 04:03:59PM +0200, Mike Rapoport wrote:
> > On Thu, Mar 12, 2026 at 07:40:23PM +0800, Chunyu Hu wrote:
> > > There are several tests requires transprarent hugepages, when run on thp
> > > disabled kernel such as realtime kernel, there will be false positve.
> >
> > I presume that when THP tests run on kernels with THP disabled they fail
> > and it would be a false negative rather than false positive.
>
> This is an interesting point. I'm not naitive speaker. I just learned
> from AI. It really matters what we define as 'postive'. I presume 'postive'
> is we run selftest and got a failure report, that's postive, not thinking
> as it's thp disabled kernel and a 'pass' is postive.
I think that a passing test is "positive" and a failing test is "negative".
So a test that fails because of misconfiguration is a false negative to me.
> I'll add statement about 'postive' in v2 like "a test failure is
> defiend as postive"
>
> >
> > > Mark those tests as skip when thp is not available.
> > >
> > > Chunye Hu (4):
> > > selftests/mm/guard-regions: skip collapse test when thp not enabled
> > > selftests/mm: soft-dirty: skip two tests when thp not available
> > > selftests/mm: split_huge_page_test: skip the test when thp not
> > > available
> > > selftests/mm: transhuge_stress: skip the test when thp not available
> > >
> > > tools/testing/selftests/mm/guard-regions.c | 4 ++++
> > > tools/testing/selftests/mm/soft-dirty.c | 4 +++-
> > > tools/testing/selftests/mm/split_huge_page_test.c | 9 +++++++--
> > > tools/testing/selftests/mm/transhuge-stress.c | 4 ++++
> > > 4 files changed, 18 insertions(+), 3 deletions(-)
> > >
> > >
> > > base-commit: 80234b5ab240f52fa45d201e899e207b9265ef91
> > > --
> > > 2.53.0
> > >
> >
> > --
> > Sincerely yours,
> > Mike.
> >
>
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [RESEND PATCH 3/4] selftests/mm: split_huge_page_test: skip the test when thp is not available
2026-03-13 15:15 ` Mike Rapoport
@ 2026-03-13 15:27 ` Zi Yan
2026-03-13 18:00 ` Lorenzo Stoakes (Oracle)
2026-03-16 3:51 ` Chunyu Hu
2026-03-16 3:46 ` Chunyu Hu
1 sibling, 2 replies; 34+ messages in thread
From: Zi Yan @ 2026-03-13 15:27 UTC (permalink / raw)
To: Mike Rapoport
Cc: Chunyu Hu, akpm, david, shuah, linux-mm, ljs, linux-kselftest,
linux-kernel, lorenzo.stoakes, Liam.Howlett, vbabka, surenb,
mhocko, baolin.wang, npache, ryan.roberts, dev.jain, baohua,
lance.yang, Li Wang
On 13 Mar 2026, at 11:15, Mike Rapoport wrote:
> On Thu, Mar 12, 2026 at 10:11:12AM -0400, Zi Yan wrote:
>> On 12 Mar 2026, at 7:40, Chunyu Hu wrote:
>>
>>> When thp is not enabled on some kernel config such as realtime kernel, the
>>> test will report failure. Fix the false positive by skipping the test
>>> directly when thp is not enabled.
>>>
>>> There's a naming conflict on write_file() function, both thp_settings.h and
>>> split_huge_page_test.c define it. To make use of thp_is_enabled() helper in
>>> the thp_settings.h, rename this local write_file to safe_write_file to
>>> avoid the conflict. The reason to use 'safe_' is it does some error check.
>>
>> Both write_file() do safe checks. Actually the code of both functions looks
>> almost identical except that the thp_settings one does exit() instead of
>> ksft_exit_fail_msg().
>>
>> Can you rename the split_huge_page_test’s write_file() to write_file_local()
>> and add a comment above the function like
>> /* add _local to avoid a function conflict with thp_settings.h */?
>
> Looks like we can move the version that uses ksft_exit_fail_msg() to
> vm_util and drop the other one.
Could work.
tools/testing/selftests/mm/khugepaged.c uses the write_file() from
thp_settings.h in file_setup_area(), which is part of struct mem_ops.
I thought struct mem_ops was passed to some syscall, but it turns out
that it is used locally. The only downside is that file_setup_area() now
has this ksefltest friendly code. Someone might want to clean up
tools/testing/selftests/mm/khugepaged.c with kselftests APIs. :)
>
>> With that, feel free to add:
>>
>> Reviewed-by: Zi Yan <ziy@nvidia.com>
>>
>> Thanks.
>>
>>>
>>> Tested with thp disabled kernel:
>>> Before The fix:
>>> # --------------------------------------------------
>>> # running ./split_huge_page_test /tmp/xfs_dir_Ywup9p
>>> # --------------------------------------------------
>>> # TAP version 13
>>> # Bail out! Reading PMD pagesize failed
>>> # # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:0 error:0
>>> # [FAIL]
>>> not ok 61 split_huge_page_test /tmp/xfs_dir_Ywup9p # exit=1
>>>
>>> After the fix:
>>> # --------------------------------------------------
>>> # running ./split_huge_page_test /tmp/xfs_dir_YHPUPl
>>> # --------------------------------------------------
>>> # TAP version 13
>>> # 1..0 # SKIP Transparent Hugepages not available
>>> # [SKIP]
>>> ok 6 split_huge_page_test /tmp/xfs_dir_YHPUPl # SKIP
>>>
>>> CC: Li Wang <liwang@redhat.com>
>>> Signed-off-by: Chunyu Hu <chuhu@redhat.com>
>>> ---
>>> tools/testing/selftests/mm/split_huge_page_test.c | 9 +++++++--
>>> 1 file changed, 7 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/tools/testing/selftests/mm/split_huge_page_test.c b/tools/testing/selftests/mm/split_huge_page_test.c
>>> index e0167111bdd1..615b75ca62cc 100644
>>> --- a/tools/testing/selftests/mm/split_huge_page_test.c
>>> +++ b/tools/testing/selftests/mm/split_huge_page_test.c
>>> @@ -21,6 +21,7 @@
>>> #include <time.h>
>>> #include "vm_util.h"
>>> #include "kselftest.h"
>>> +#include "thp_settings.h"
>>>
>>> uint64_t pagesize;
>>> unsigned int pageshift;
>>> @@ -255,7 +256,7 @@ static int check_after_split_folio_orders(char *vaddr_start, size_t len,
>>> return status;
>>> }
>>>
>>> -static void write_file(const char *path, const char *buf, size_t buflen)
>>> +static void safe_write_file(const char *path, const char *buf, size_t buflen)
>>> {
>>> int fd;
>>> ssize_t numwritten;
>>> @@ -283,7 +284,7 @@ static void write_debugfs(const char *fmt, ...)
>>> if (ret >= INPUT_MAX)
>>> ksft_exit_fail_msg("%s: Debugfs input is too long\n", __func__);
>>>
>>> - write_file(SPLIT_DEBUGFS, input, ret + 1);
>>> + safe_write_file(SPLIT_DEBUGFS, input, ret + 1);
>>> }
>>>
>>> static char *allocate_zero_filled_hugepage(size_t len)
>>> @@ -772,6 +773,10 @@ int main(int argc, char **argv)
>>> ksft_finished();
>>> }
>>>
>>> + if (!thp_is_enabled()) {
>>> + ksft_exit_skip("Transparent Hugepages not available\n");
>>> + }
>>> +
>>> if (argc > 1)
>>> optional_xfs_path = argv[1];
>>>
>>> --
>>> 2.53.0
>>
>>
>> Best Regards,
>> Yan, Zi
>
> --
> Sincerely yours,
> Mike.
Best Regards,
Yan, Zi
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [RESEND PATCH 1/4] selftests/mm/guard-regions: skip collapse test when thp not enabled
2026-03-12 11:40 ` [RESEND PATCH 1/4] selftests/mm/guard-regions: skip collapse test when thp not enabled Chunyu Hu
2026-03-12 13:58 ` Zi Yan
2026-03-12 19:48 ` David Hildenbrand (Arm)
@ 2026-03-13 15:35 ` Lorenzo Stoakes (Oracle)
2 siblings, 0 replies; 34+ messages in thread
From: Lorenzo Stoakes (Oracle) @ 2026-03-13 15:35 UTC (permalink / raw)
To: Chunyu Hu
Cc: akpm, david, shuah, linux-mm, linux-kselftest, linux-kernel,
lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb, mhocko, ziy,
baolin.wang, npache, ryan.roberts, dev.jain, baohua, lance.yang,
Li Wang
On Thu, Mar 12, 2026 at 07:40:24PM +0800, Chunyu Hu wrote:
> When thp is not available, just skip the collape tests to avoid the false
> positive.
>
> Without the change, run with a thp disabled kernel:
> ./run_vmtests.sh -t madv_guard
> <snip/>
> # # RUN guard_regions.file.multi_vma ...
> # # OK guard_regions.file.multi_vma
> # ok 89 guard_regions.file.multi_vma
> # # RUN guard_regions.file.basic ...
> # # OK guard_regions.file.basic
> # ok 90 guard_regions.file.basic
> # # FAILED: 87 / 90 tests passed.
> # # 17 skipped test(s) detected. Consider enabling relevant config options to improve coverage.
> # # Totals: pass:70 fail:3 xfail:0 xpass:0 skip:17 error:0
> # [FAIL]
> not ok 1 guard-regions # exit=1
> hwpoison_inject
> # SUMMARY: PASS=0 SKIP=0 FAIL=1
>
> With this change, run with thp disabled kernel:
> ./run_vmtests.sh -t madv_guard
> <snip/>
> # ok 90 guard_regions.file.basic
> # # PASSED: 90 / 90 tests passed.
> # # 20 skipped test(s) detected. Consider enabling relevant config options to improve coverage.
> # # Totals: pass:70 fail:0 xfail:0 xpass:0 skip:20 error:0
> # [PASS]
> ok 1 guard-regions
> hwpoison_inject
> # SUMMARY: PASS=1 SKIP=0 FAIL=0
> 1..1
> CC: Li Wang <liwang@redhat.com>
> Signed-off-by: Chunyu Hu <chuhu@redhat.com>
LGTM thanks, so:
Reviewed-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org>
> ---
> tools/testing/selftests/mm/guard-regions.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/tools/testing/selftests/mm/guard-regions.c b/tools/testing/selftests/mm/guard-regions.c
> index dbd21d66d383..897af9c512f9 100644
> --- a/tools/testing/selftests/mm/guard-regions.c
> +++ b/tools/testing/selftests/mm/guard-regions.c
> @@ -21,6 +21,7 @@
> #include <sys/uio.h>
> #include <unistd.h>
> #include "vm_util.h"
> +#include "thp_settings.h"
>
> #include "../pidfd/pidfd.h"
>
> @@ -2195,6 +2196,9 @@ TEST_F(guard_regions, collapse)
> char *ptr;
> int i;
>
> + if (!thp_is_enabled())
> + SKIP(return, "Transparent Hugepages not available\n");
> +
> /* Need file to be correct size for tests for non-anon. */
> if (variant->backing != ANON_BACKED)
> ASSERT_EQ(ftruncate(self->fd, size), 0);
> --
> 2.53.0
>
Cheers, Lorenzo
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 0/4] selftests/mm: skip several tests when thp is not available
2026-03-13 15:19 ` Mike Rapoport
@ 2026-03-13 15:40 ` Lorenzo Stoakes (Oracle)
2026-03-14 0:22 ` Chunyu Hu
2026-03-14 0:27 ` Chunyu Hu
1 sibling, 1 reply; 34+ messages in thread
From: Lorenzo Stoakes (Oracle) @ 2026-03-13 15:40 UTC (permalink / raw)
To: Mike Rapoport
Cc: Chunyu Hu, akpm, david, shuah, linux-mm, linux-kselftest,
linux-kernel, lorenzo.stoakes, Liam.Howlett, vbabka, surenb,
mhocko, ziy, baolin.wang, npache, ryan.roberts, dev.jain, baohua,
lance.yang
On Fri, Mar 13, 2026 at 05:19:20PM +0200, Mike Rapoport wrote:
> On Fri, Mar 13, 2026 at 08:26:02AM +0800, Chunyu Hu wrote:
> > On Thu, Mar 12, 2026 at 04:03:59PM +0200, Mike Rapoport wrote:
> > > On Thu, Mar 12, 2026 at 07:40:23PM +0800, Chunyu Hu wrote:
> > > > There are several tests requires transprarent hugepages, when run on thp
> > > > disabled kernel such as realtime kernel, there will be false positve.
> > >
> > > I presume that when THP tests run on kernels with THP disabled they fail
> > > and it would be a false negative rather than false positive.
> >
> > This is an interesting point. I'm not naitive speaker. I just learned
> > from AI. It really matters what we define as 'postive'. I presume 'postive'
> > is we run selftest and got a failure report, that's postive, not thinking
> > as it's thp disabled kernel and a 'pass' is postive.
>
> I think that a passing test is "positive" and a failing test is "negative".
> So a test that fails because of misconfiguration is a false negative to me.
(Ostensibly native speaker here :P)
Yes.
False positive = the test passed when it should have failed.
False negative = The test failed when it should have passed.
Cheers, Lorenzo
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [RESEND PATCH 2/4] selftests/mm: soft-dirty: skip two tests when thp is not available
2026-03-12 11:40 ` [RESEND PATCH 2/4] selftests/mm: soft-dirty: skip two tests when thp is not available Chunyu Hu
2026-03-12 14:00 ` Zi Yan
2026-03-12 19:43 ` David Hildenbrand (Arm)
@ 2026-03-13 17:37 ` Lorenzo Stoakes (Oracle)
2 siblings, 0 replies; 34+ messages in thread
From: Lorenzo Stoakes (Oracle) @ 2026-03-13 17:37 UTC (permalink / raw)
To: Chunyu Hu
Cc: akpm, david, shuah, linux-mm, linux-kselftest, linux-kernel,
lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb, mhocko, ziy,
baolin.wang, npache, ryan.roberts, dev.jain, baohua, lance.yang,
Li Wang
On Thu, Mar 12, 2026 at 07:40:25PM +0800, Chunyu Hu wrote:
> The test_hugepage test contain two sub tests. If just reporting one skip
> when thp not available, there will be error in the log because the test
> count don't match the test plan. Change to skip two tests by running the
> ksft_test_result_skip twice in this case.
>
> Without the fix (run test on thp disabled kernel):
> ./run_vmtests.sh -t soft_dirty
> # --------------------
> # running ./soft-dirty
> # --------------------
> # TAP version 13
> # 1..19
> # ok 1 Test test_simple
> # ok 2 Test test_vma_reuse dirty bit of allocated page
> # ok 3 Test test_vma_reuse dirty bit of reused address page
> # ok 4 # SKIP Transparent Hugepages not available
> # ok 5 Test test_mprotect-anon dirty bit of new written page
> # ok 6 Test test_mprotect-anon soft-dirty clear after clear_refs
> # ok 7 Test test_mprotect-anon soft-dirty clear after marking RO
> # ok 8 Test test_mprotect-anon soft-dirty clear after marking RW
> # ok 9 Test test_mprotect-anon soft-dirty after rewritten
> # ok 10 Test test_mprotect-file dirty bit of new written page
> # ok 11 Test test_mprotect-file soft-dirty clear after clear_refs
> # ok 12 Test test_mprotect-file soft-dirty clear after marking RO
> # ok 13 Test test_mprotect-file soft-dirty clear after marking RW
> # ok 14 Test test_mprotect-file soft-dirty after rewritten
> # ok 15 Test test_merge-anon soft-dirty after remap merge 1st pg
> # ok 16 Test test_merge-anon soft-dirty after remap merge 2nd pg
> # ok 17 Test test_merge-anon soft-dirty after mprotect merge 1st pg
> # ok 18 Test test_merge-anon soft-dirty after mprotect merge 2nd pg
> # # 1 skipped test(s) detected. Consider enabling relevant config options to improve coverage.
> # # Planned tests != run tests (19 != 18)
> # # Totals: pass:17 fail:0 xfail:0 xpass:0 skip:1 error:0
> # [FAIL]
> not ok 52 soft-dirty # exit=1
>
> With the fix (run test on thp disabled kernel):
> ./run_vmtests.sh -t soft_dirty
> # --------------------
> # running ./soft-dirty
> # TAP version 13
> # --------------------
> # running ./soft-dirty
> # --------------------
> # TAP version 13
> # 1..19
> # ok 1 Test test_simple
> # ok 2 Test test_vma_reuse dirty bit of allocated page
> # ok 3 Test test_vma_reuse dirty bit of reused address page
> # # Transparent Hugepages not available
> # ok 4 # SKIP Test test_hugepage huge page allocation
> # ok 5 # SKIP Test test_hugepage huge page dirty bit
> # ok 6 Test test_mprotect-anon dirty bit of new written page
> # ok 7 Test test_mprotect-anon soft-dirty clear after clear_refs
> # ok 8 Test test_mprotect-anon soft-dirty clear after marking RO
> # ok 9 Test test_mprotect-anon soft-dirty clear after marking RW
> # ok 10 Test test_mprotect-anon soft-dirty after rewritten
> # ok 11 Test test_mprotect-file dirty bit of new written page
> # ok 12 Test test_mprotect-file soft-dirty clear after clear_refs
> # ok 13 Test test_mprotect-file soft-dirty clear after marking RO
> # ok 14 Test test_mprotect-file soft-dirty clear after marking RW
> # ok 15 Test test_mprotect-file soft-dirty after rewritten
> # ok 16 Test test_merge-anon soft-dirty after remap merge 1st pg
> # ok 17 Test test_merge-anon soft-dirty after remap merge 2nd pg
> # ok 18 Test test_merge-anon soft-dirty after mprotect merge 1st pg
> # ok 19 Test test_merge-anon soft-dirty after mprotect merge 2nd pg
> # # 2 skipped test(s) detected. Consider enabling relevant config options to improve coverage.
> # # Totals: pass:17 fail:0 xfail:0 xpass:0 skip:2 error:0
> # [PASS]
> ok 1 soft-dirty
> hwpoison_inject
> # SUMMARY: PASS=1 SKIP=0 FAIL=0
> 1..1
> CC: Li Wang <liwang@redhat.com>
> Signed-off-by: Chunyu Hu <chuhu@redhat.com>
LGTM, so:
Reviewed-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org>
> ---
> tools/testing/selftests/mm/soft-dirty.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/mm/soft-dirty.c b/tools/testing/selftests/mm/soft-dirty.c
> index 59c0dbe99a9b..bcfcac99b436 100644
> --- a/tools/testing/selftests/mm/soft-dirty.c
> +++ b/tools/testing/selftests/mm/soft-dirty.c
> @@ -82,7 +82,9 @@ static void test_hugepage(int pagemap_fd, int pagesize)
> int i, ret;
>
> if (!thp_is_enabled()) {
> - ksft_test_result_skip("Transparent Hugepages not available\n");
> + ksft_print_msg("Transparent Hugepages not available\n");
> + ksft_test_result_skip("Test %s huge page allocation\n", __func__);
> + ksft_test_result_skip("Test %s huge page dirty bit\n", __func__);
> return;
> }
>
> --
> 2.53.0
>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [RESEND PATCH 3/4] selftests/mm: split_huge_page_test: skip the test when thp is not available
2026-03-13 15:27 ` Zi Yan
@ 2026-03-13 18:00 ` Lorenzo Stoakes (Oracle)
2026-03-16 3:51 ` Chunyu Hu
1 sibling, 0 replies; 34+ messages in thread
From: Lorenzo Stoakes (Oracle) @ 2026-03-13 18:00 UTC (permalink / raw)
To: Zi Yan
Cc: Mike Rapoport, Chunyu Hu, akpm, david, shuah, linux-mm,
linux-kselftest, linux-kernel, lorenzo.stoakes, Liam.Howlett,
vbabka, surenb, mhocko, baolin.wang, npache, ryan.roberts,
dev.jain, baohua, lance.yang, Li Wang
On Fri, Mar 13, 2026 at 11:27:30AM -0400, Zi Yan wrote:
> On 13 Mar 2026, at 11:15, Mike Rapoport wrote:
>
> > On Thu, Mar 12, 2026 at 10:11:12AM -0400, Zi Yan wrote:
> >> On 12 Mar 2026, at 7:40, Chunyu Hu wrote:
> >>
> >>> When thp is not enabled on some kernel config such as realtime kernel, the
> >>> test will report failure. Fix the false positive by skipping the test
> >>> directly when thp is not enabled.
> >>>
> >>> There's a naming conflict on write_file() function, both thp_settings.h and
> >>> split_huge_page_test.c define it. To make use of thp_is_enabled() helper in
> >>> the thp_settings.h, rename this local write_file to safe_write_file to
> >>> avoid the conflict. The reason to use 'safe_' is it does some error check.
> >>
> >> Both write_file() do safe checks. Actually the code of both functions looks
> >> almost identical except that the thp_settings one does exit() instead of
> >> ksft_exit_fail_msg().
> >>
> >> Can you rename the split_huge_page_test’s write_file() to write_file_local()
> >> and add a comment above the function like
> >> /* add _local to avoid a function conflict with thp_settings.h */?
> >
> > Looks like we can move the version that uses ksft_exit_fail_msg() to
> > vm_util and drop the other one.
>
> Could work.
>
> tools/testing/selftests/mm/khugepaged.c uses the write_file() from
> thp_settings.h in file_setup_area(), which is part of struct mem_ops.
> I thought struct mem_ops was passed to some syscall, but it turns out
> that it is used locally. The only downside is that file_setup_area() now
> has this ksefltest friendly code. Someone might want to clean up
> tools/testing/selftests/mm/khugepaged.c with kselftests APIs. :)
Yes please :)
With Mike's suggestion, LGTM so:
Reviewed-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org>
>
>
> >
> >> With that, feel free to add:
> >>
> >> Reviewed-by: Zi Yan <ziy@nvidia.com>
> >>
> >> Thanks.
> >>
> >>>
> >>> Tested with thp disabled kernel:
> >>> Before The fix:
> >>> # --------------------------------------------------
> >>> # running ./split_huge_page_test /tmp/xfs_dir_Ywup9p
> >>> # --------------------------------------------------
> >>> # TAP version 13
> >>> # Bail out! Reading PMD pagesize failed
> >>> # # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:0 error:0
> >>> # [FAIL]
> >>> not ok 61 split_huge_page_test /tmp/xfs_dir_Ywup9p # exit=1
> >>>
> >>> After the fix:
> >>> # --------------------------------------------------
> >>> # running ./split_huge_page_test /tmp/xfs_dir_YHPUPl
> >>> # --------------------------------------------------
> >>> # TAP version 13
> >>> # 1..0 # SKIP Transparent Hugepages not available
> >>> # [SKIP]
> >>> ok 6 split_huge_page_test /tmp/xfs_dir_YHPUPl # SKIP
> >>>
> >>> CC: Li Wang <liwang@redhat.com>
> >>> Signed-off-by: Chunyu Hu <chuhu@redhat.com>
> >>> ---
> >>> tools/testing/selftests/mm/split_huge_page_test.c | 9 +++++++--
> >>> 1 file changed, 7 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/tools/testing/selftests/mm/split_huge_page_test.c b/tools/testing/selftests/mm/split_huge_page_test.c
> >>> index e0167111bdd1..615b75ca62cc 100644
> >>> --- a/tools/testing/selftests/mm/split_huge_page_test.c
> >>> +++ b/tools/testing/selftests/mm/split_huge_page_test.c
> >>> @@ -21,6 +21,7 @@
> >>> #include <time.h>
> >>> #include "vm_util.h"
> >>> #include "kselftest.h"
> >>> +#include "thp_settings.h"
> >>>
> >>> uint64_t pagesize;
> >>> unsigned int pageshift;
> >>> @@ -255,7 +256,7 @@ static int check_after_split_folio_orders(char *vaddr_start, size_t len,
> >>> return status;
> >>> }
> >>>
> >>> -static void write_file(const char *path, const char *buf, size_t buflen)
> >>> +static void safe_write_file(const char *path, const char *buf, size_t buflen)
> >>> {
> >>> int fd;
> >>> ssize_t numwritten;
> >>> @@ -283,7 +284,7 @@ static void write_debugfs(const char *fmt, ...)
> >>> if (ret >= INPUT_MAX)
> >>> ksft_exit_fail_msg("%s: Debugfs input is too long\n", __func__);
> >>>
> >>> - write_file(SPLIT_DEBUGFS, input, ret + 1);
> >>> + safe_write_file(SPLIT_DEBUGFS, input, ret + 1);
> >>> }
> >>>
> >>> static char *allocate_zero_filled_hugepage(size_t len)
> >>> @@ -772,6 +773,10 @@ int main(int argc, char **argv)
> >>> ksft_finished();
> >>> }
> >>>
> >>> + if (!thp_is_enabled()) {
> >>> + ksft_exit_skip("Transparent Hugepages not available\n");
> >>> + }
> >>> +
> >>> if (argc > 1)
> >>> optional_xfs_path = argv[1];
> >>>
> >>> --
> >>> 2.53.0
> >>
> >>
> >> Best Regards,
> >> Yan, Zi
> >
> > --
> > Sincerely yours,
> > Mike.
>
>
> Best Regards,
> Yan, Zi
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [RESEND PATCH 4/4] selftests/mm: transhuge_stress: skip the test when thp not available
2026-03-13 2:43 ` Chunyu Hu
@ 2026-03-13 18:01 ` Lorenzo Stoakes (Oracle)
0 siblings, 0 replies; 34+ messages in thread
From: Lorenzo Stoakes (Oracle) @ 2026-03-13 18:01 UTC (permalink / raw)
To: Chunyu Hu
Cc: David Hildenbrand (Arm), akpm, shuah, linux-mm, linux-kselftest,
linux-kernel, lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb,
mhocko, ziy, baolin.wang, npache, ryan.roberts, dev.jain, baohua,
lance.yang, Li Wang
On Fri, Mar 13, 2026 at 10:43:27AM +0800, Chunyu Hu wrote:
> On Thu, Mar 12, 2026 at 08:46:23PM +0100, David Hildenbrand (Arm) wrote:
> > On 3/12/26 12:40, Chunyu Hu wrote:
> > > The test requires thp, skip the test when thp is not available to avoid
> > > false positive.
> > >
> > > Tested with thp disabled kernel.
> > > Before the fix:
> > > # --------------------------------
> > > # running ./transhuge-stress -d 20
> > > # --------------------------------
> > > # TAP version 13
> > > # 1..1
> > > # transhuge-stress: allocate 1453 transhuge pages, using 2907 MiB virtual memory and 11 MiB of ram
> > > # Bail out! MADV_HUGEPAGE# Planned tests != run tests (1 != 0)
> > > # # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:0 error:0
> > > # [FAIL]
> > > not ok 60 transhuge-stress -d 20 # exit=1
> > >
> > > After the fix:
> > > # --------------------------------
> > > # running ./transhuge-stress -d 20
> > > # --------------------------------
> > > # 1..0 # SKIP Transparent Hugepages not available
> > > # [SKIP]
> > > ok 5 transhuge-stress -d 20 # SKIP
> > >
> > > CC: Li Wang <liwang@redhat.com>
> > > Signed-off-by: Chunyu Hu <chuhu@redhat.com>
> > > ---
> > > tools/testing/selftests/mm/transhuge-stress.c | 4 ++++
> > > 1 file changed, 4 insertions(+)
> > >
> > > diff --git a/tools/testing/selftests/mm/transhuge-stress.c b/tools/testing/selftests/mm/transhuge-stress.c
> > > index bcad47c09518..76316696426d 100644
> > > --- a/tools/testing/selftests/mm/transhuge-stress.c
> > > +++ b/tools/testing/selftests/mm/transhuge-stress.c
> > > @@ -17,6 +17,7 @@
> > > #include <sys/mman.h>
> > > #include "vm_util.h"
> > > #include "kselftest.h"
> > > +#include "thp_settings.h"
> > >
> > > int backing_fd = -1;
> > > int mmap_flags = MAP_ANONYMOUS | MAP_NORESERVE | MAP_PRIVATE;
> > > @@ -35,6 +36,9 @@ int main(int argc, char **argv)
> > > int pagemap_fd;
> > > int duration = 0;
> > >
> > > + if (!thp_is_enabled())
> > > + ksft_exit_skip("Transparent Hugepages not available\n");
> > > +
> > > ksft_print_header();
> >
> > Shouldn't that go under the ksft_print_header(), like you did in patch #3?
>
> It will print the TAP version. I'll change in v2 as you suggested. Thanks!
With that done, LGTM and:
Reviewed-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org>
>
> >
> > --
> > Cheers,
> >
> > David
> >
>
Cheers, Lorenzo
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 0/4] selftests/mm: skip several tests when thp is not available
2026-03-13 15:40 ` Lorenzo Stoakes (Oracle)
@ 2026-03-14 0:22 ` Chunyu Hu
0 siblings, 0 replies; 34+ messages in thread
From: Chunyu Hu @ 2026-03-14 0:22 UTC (permalink / raw)
To: Lorenzo Stoakes (Oracle)
Cc: Mike Rapoport, akpm, david, shuah, linux-mm, linux-kselftest,
linux-kernel, lorenzo.stoakes, Liam.Howlett, vbabka, surenb,
mhocko, ziy, baolin.wang, npache, ryan.roberts, dev.jain, baohua,
lance.yang
On Fri, Mar 13, 2026 at 03:40:14PM +0000, Lorenzo Stoakes (Oracle) wrote:
> On Fri, Mar 13, 2026 at 05:19:20PM +0200, Mike Rapoport wrote:
> > On Fri, Mar 13, 2026 at 08:26:02AM +0800, Chunyu Hu wrote:
> > > On Thu, Mar 12, 2026 at 04:03:59PM +0200, Mike Rapoport wrote:
> > > > On Thu, Mar 12, 2026 at 07:40:23PM +0800, Chunyu Hu wrote:
> > > > > There are several tests requires transprarent hugepages, when run on thp
> > > > > disabled kernel such as realtime kernel, there will be false positve.
> > > >
> > > > I presume that when THP tests run on kernels with THP disabled they fail
> > > > and it would be a false negative rather than false positive.
> > >
> > > This is an interesting point. I'm not naitive speaker. I just learned
> > > from AI. It really matters what we define as 'postive'. I presume 'postive'
> > > is we run selftest and got a failure report, that's postive, not thinking
> > > as it's thp disabled kernel and a 'pass' is postive.
> >
> > I think that a passing test is "positive" and a failing test is "negative".
> > So a test that fails because of misconfiguration is a false negative to me.
>
> (Ostensibly native speaker here :P)
>
> Yes.
>
> False positive = the test passed when it should have failed.
> False negative = The test failed when it should have passed.
Ok. Thank you for clarify. I'll use 'false netative' instead .
>
> Cheers, Lorenzo
>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 0/4] selftests/mm: skip several tests when thp is not available
2026-03-13 15:19 ` Mike Rapoport
2026-03-13 15:40 ` Lorenzo Stoakes (Oracle)
@ 2026-03-14 0:27 ` Chunyu Hu
1 sibling, 0 replies; 34+ messages in thread
From: Chunyu Hu @ 2026-03-14 0:27 UTC (permalink / raw)
To: Mike Rapoport
Cc: akpm, david, shuah, linux-mm, ljs, linux-kselftest, linux-kernel,
lorenzo.stoakes, Liam.Howlett, vbabka, surenb, mhocko, ziy,
baolin.wang, npache, ryan.roberts, dev.jain, baohua, lance.yang
On Fri, Mar 13, 2026 at 05:19:20PM +0200, Mike Rapoport wrote:
> On Fri, Mar 13, 2026 at 08:26:02AM +0800, Chunyu Hu wrote:
> > On Thu, Mar 12, 2026 at 04:03:59PM +0200, Mike Rapoport wrote:
> > > On Thu, Mar 12, 2026 at 07:40:23PM +0800, Chunyu Hu wrote:
> > > > There are several tests requires transprarent hugepages, when run on thp
> > > > disabled kernel such as realtime kernel, there will be false positve.
> > >
> > > I presume that when THP tests run on kernels with THP disabled they fail
> > > and it would be a false negative rather than false positive.
> >
> > This is an interesting point. I'm not naitive speaker. I just learned
> > from AI. It really matters what we define as 'postive'. I presume 'postive'
> > is we run selftest and got a failure report, that's postive, not thinking
> > as it's thp disabled kernel and a 'pass' is postive.
>
> I think that a passing test is "positive" and a failing test is "negative".
> So a test that fails because of misconfiguration is a false negative to me.
Thank you for the explanation. I unserstand now. Let's use 'false
negative'.
>
> > I'll add statement about 'postive' in v2 like "a test failure is
> > defiend as postive"
> >
> > >
> > > > Mark those tests as skip when thp is not available.
> > > >
> > > > Chunye Hu (4):
> > > > selftests/mm/guard-regions: skip collapse test when thp not enabled
> > > > selftests/mm: soft-dirty: skip two tests when thp not available
> > > > selftests/mm: split_huge_page_test: skip the test when thp not
> > > > available
> > > > selftests/mm: transhuge_stress: skip the test when thp not available
> > > >
> > > > tools/testing/selftests/mm/guard-regions.c | 4 ++++
> > > > tools/testing/selftests/mm/soft-dirty.c | 4 +++-
> > > > tools/testing/selftests/mm/split_huge_page_test.c | 9 +++++++--
> > > > tools/testing/selftests/mm/transhuge-stress.c | 4 ++++
> > > > 4 files changed, 18 insertions(+), 3 deletions(-)
> > > >
> > > >
> > > > base-commit: 80234b5ab240f52fa45d201e899e207b9265ef91
> > > > --
> > > > 2.53.0
> > > >
> > >
> > > --
> > > Sincerely yours,
> > > Mike.
> > >
> >
>
> --
> Sincerely yours,
> Mike.
>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [RESEND PATCH 3/4] selftests/mm: split_huge_page_test: skip the test when thp is not available
2026-03-13 15:15 ` Mike Rapoport
2026-03-13 15:27 ` Zi Yan
@ 2026-03-16 3:46 ` Chunyu Hu
1 sibling, 0 replies; 34+ messages in thread
From: Chunyu Hu @ 2026-03-16 3:46 UTC (permalink / raw)
To: Mike Rapoport
Cc: Zi Yan, akpm, david, shuah, linux-mm, ljs, linux-kselftest,
linux-kernel, lorenzo.stoakes, Liam.Howlett, vbabka, surenb,
mhocko, baolin.wang, npache, ryan.roberts, dev.jain, baohua,
lance.yang, Li Wang
On Fri, Mar 13, 2026 at 05:15:57PM +0200, Mike Rapoport wrote:
> On Thu, Mar 12, 2026 at 10:11:12AM -0400, Zi Yan wrote:
> > On 12 Mar 2026, at 7:40, Chunyu Hu wrote:
> >
> > > When thp is not enabled on some kernel config such as realtime kernel, the
> > > test will report failure. Fix the false positive by skipping the test
> > > directly when thp is not enabled.
> > >
> > > There's a naming conflict on write_file() function, both thp_settings.h and
> > > split_huge_page_test.c define it. To make use of thp_is_enabled() helper in
> > > the thp_settings.h, rename this local write_file to safe_write_file to
> > > avoid the conflict. The reason to use 'safe_' is it does some error check.
> >
> > Both write_file() do safe checks. Actually the code of both functions looks
> > almost identical except that the thp_settings one does exit() instead of
> > ksft_exit_fail_msg().
> >
> > Can you rename the split_huge_page_test’s write_file() to write_file_local()
> > and add a comment above the function like
> > /* add _local to avoid a function conflict with thp_settings.h */?
>
> Looks like we can move the version that uses ksft_exit_fail_msg() to
> vm_util and drop the other one.
Good point. I'll try this in the v2. And I think we can keep return
value.
>
> > With that, feel free to add:
> >
> > Reviewed-by: Zi Yan <ziy@nvidia.com>
> >
> > Thanks.
> >
> > >
> > > Tested with thp disabled kernel:
> > > Before The fix:
> > > # --------------------------------------------------
> > > # running ./split_huge_page_test /tmp/xfs_dir_Ywup9p
> > > # --------------------------------------------------
> > > # TAP version 13
> > > # Bail out! Reading PMD pagesize failed
> > > # # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:0 error:0
> > > # [FAIL]
> > > not ok 61 split_huge_page_test /tmp/xfs_dir_Ywup9p # exit=1
> > >
> > > After the fix:
> > > # --------------------------------------------------
> > > # running ./split_huge_page_test /tmp/xfs_dir_YHPUPl
> > > # --------------------------------------------------
> > > # TAP version 13
> > > # 1..0 # SKIP Transparent Hugepages not available
> > > # [SKIP]
> > > ok 6 split_huge_page_test /tmp/xfs_dir_YHPUPl # SKIP
> > >
> > > CC: Li Wang <liwang@redhat.com>
> > > Signed-off-by: Chunyu Hu <chuhu@redhat.com>
> > > ---
> > > tools/testing/selftests/mm/split_huge_page_test.c | 9 +++++++--
> > > 1 file changed, 7 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/tools/testing/selftests/mm/split_huge_page_test.c b/tools/testing/selftests/mm/split_huge_page_test.c
> > > index e0167111bdd1..615b75ca62cc 100644
> > > --- a/tools/testing/selftests/mm/split_huge_page_test.c
> > > +++ b/tools/testing/selftests/mm/split_huge_page_test.c
> > > @@ -21,6 +21,7 @@
> > > #include <time.h>
> > > #include "vm_util.h"
> > > #include "kselftest.h"
> > > +#include "thp_settings.h"
> > >
> > > uint64_t pagesize;
> > > unsigned int pageshift;
> > > @@ -255,7 +256,7 @@ static int check_after_split_folio_orders(char *vaddr_start, size_t len,
> > > return status;
> > > }
> > >
> > > -static void write_file(const char *path, const char *buf, size_t buflen)
> > > +static void safe_write_file(const char *path, const char *buf, size_t buflen)
> > > {
> > > int fd;
> > > ssize_t numwritten;
> > > @@ -283,7 +284,7 @@ static void write_debugfs(const char *fmt, ...)
> > > if (ret >= INPUT_MAX)
> > > ksft_exit_fail_msg("%s: Debugfs input is too long\n", __func__);
> > >
> > > - write_file(SPLIT_DEBUGFS, input, ret + 1);
> > > + safe_write_file(SPLIT_DEBUGFS, input, ret + 1);
> > > }
> > >
> > > static char *allocate_zero_filled_hugepage(size_t len)
> > > @@ -772,6 +773,10 @@ int main(int argc, char **argv)
> > > ksft_finished();
> > > }
> > >
> > > + if (!thp_is_enabled()) {
> > > + ksft_exit_skip("Transparent Hugepages not available\n");
> > > + }
> > > +
> > > if (argc > 1)
> > > optional_xfs_path = argv[1];
> > >
> > > --
> > > 2.53.0
> >
> >
> > Best Regards,
> > Yan, Zi
>
> --
> Sincerely yours,
> Mike.
>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [RESEND PATCH 3/4] selftests/mm: split_huge_page_test: skip the test when thp is not available
2026-03-13 15:27 ` Zi Yan
2026-03-13 18:00 ` Lorenzo Stoakes (Oracle)
@ 2026-03-16 3:51 ` Chunyu Hu
1 sibling, 0 replies; 34+ messages in thread
From: Chunyu Hu @ 2026-03-16 3:51 UTC (permalink / raw)
To: Zi Yan
Cc: Mike Rapoport, akpm, david, shuah, linux-mm, ljs, linux-kselftest,
linux-kernel, lorenzo.stoakes, Liam.Howlett, vbabka, surenb,
mhocko, baolin.wang, npache, ryan.roberts, dev.jain, baohua,
lance.yang, Li Wang
On Fri, Mar 13, 2026 at 11:27:30AM -0400, Zi Yan wrote:
> On 13 Mar 2026, at 11:15, Mike Rapoport wrote:
>
> > On Thu, Mar 12, 2026 at 10:11:12AM -0400, Zi Yan wrote:
> >> On 12 Mar 2026, at 7:40, Chunyu Hu wrote:
> >>
> >>> When thp is not enabled on some kernel config such as realtime kernel, the
> >>> test will report failure. Fix the false positive by skipping the test
> >>> directly when thp is not enabled.
> >>>
> >>> There's a naming conflict on write_file() function, both thp_settings.h and
> >>> split_huge_page_test.c define it. To make use of thp_is_enabled() helper in
> >>> the thp_settings.h, rename this local write_file to safe_write_file to
> >>> avoid the conflict. The reason to use 'safe_' is it does some error check.
> >>
> >> Both write_file() do safe checks. Actually the code of both functions looks
> >> almost identical except that the thp_settings one does exit() instead of
> >> ksft_exit_fail_msg().
> >>
> >> Can you rename the split_huge_page_test’s write_file() to write_file_local()
> >> and add a comment above the function like
> >> /* add _local to avoid a function conflict with thp_settings.h */?
> >
> > Looks like we can move the version that uses ksft_exit_fail_msg() to
> > vm_util and drop the other one.
>
> Could work.
>
> tools/testing/selftests/mm/khugepaged.c uses the write_file() from
> thp_settings.h in file_setup_area(), which is part of struct mem_ops.
> I thought struct mem_ops was passed to some syscall, but it turns out
> that it is used locally. The only downside is that file_setup_area() now
> has this ksefltest friendly code. Someone might want to clean up
> tools/testing/selftests/mm/khugepaged.c with kselftests APIs. :)
It looks like work in my try, even before the cleanup with the
kselftest APIs.
>
>
> >
> >> With that, feel free to add:
> >>
> >> Reviewed-by: Zi Yan <ziy@nvidia.com>
> >>
> >> Thanks.
> >>
> >>>
> >>> Tested with thp disabled kernel:
> >>> Before The fix:
> >>> # --------------------------------------------------
> >>> # running ./split_huge_page_test /tmp/xfs_dir_Ywup9p
> >>> # --------------------------------------------------
> >>> # TAP version 13
> >>> # Bail out! Reading PMD pagesize failed
> >>> # # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:0 error:0
> >>> # [FAIL]
> >>> not ok 61 split_huge_page_test /tmp/xfs_dir_Ywup9p # exit=1
> >>>
> >>> After the fix:
> >>> # --------------------------------------------------
> >>> # running ./split_huge_page_test /tmp/xfs_dir_YHPUPl
> >>> # --------------------------------------------------
> >>> # TAP version 13
> >>> # 1..0 # SKIP Transparent Hugepages not available
> >>> # [SKIP]
> >>> ok 6 split_huge_page_test /tmp/xfs_dir_YHPUPl # SKIP
> >>>
> >>> CC: Li Wang <liwang@redhat.com>
> >>> Signed-off-by: Chunyu Hu <chuhu@redhat.com>
> >>> ---
> >>> tools/testing/selftests/mm/split_huge_page_test.c | 9 +++++++--
> >>> 1 file changed, 7 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/tools/testing/selftests/mm/split_huge_page_test.c b/tools/testing/selftests/mm/split_huge_page_test.c
> >>> index e0167111bdd1..615b75ca62cc 100644
> >>> --- a/tools/testing/selftests/mm/split_huge_page_test.c
> >>> +++ b/tools/testing/selftests/mm/split_huge_page_test.c
> >>> @@ -21,6 +21,7 @@
> >>> #include <time.h>
> >>> #include "vm_util.h"
> >>> #include "kselftest.h"
> >>> +#include "thp_settings.h"
> >>>
> >>> uint64_t pagesize;
> >>> unsigned int pageshift;
> >>> @@ -255,7 +256,7 @@ static int check_after_split_folio_orders(char *vaddr_start, size_t len,
> >>> return status;
> >>> }
> >>>
> >>> -static void write_file(const char *path, const char *buf, size_t buflen)
> >>> +static void safe_write_file(const char *path, const char *buf, size_t buflen)
> >>> {
> >>> int fd;
> >>> ssize_t numwritten;
> >>> @@ -283,7 +284,7 @@ static void write_debugfs(const char *fmt, ...)
> >>> if (ret >= INPUT_MAX)
> >>> ksft_exit_fail_msg("%s: Debugfs input is too long\n", __func__);
> >>>
> >>> - write_file(SPLIT_DEBUGFS, input, ret + 1);
> >>> + safe_write_file(SPLIT_DEBUGFS, input, ret + 1);
> >>> }
> >>>
> >>> static char *allocate_zero_filled_hugepage(size_t len)
> >>> @@ -772,6 +773,10 @@ int main(int argc, char **argv)
> >>> ksft_finished();
> >>> }
> >>>
> >>> + if (!thp_is_enabled()) {
> >>> + ksft_exit_skip("Transparent Hugepages not available\n");
> >>> + }
> >>> +
> >>> if (argc > 1)
> >>> optional_xfs_path = argv[1];
> >>>
> >>> --
> >>> 2.53.0
> >>
> >>
> >> Best Regards,
> >> Yan, Zi
> >
> > --
> > Sincerely yours,
> > Mike.
>
>
> Best Regards,
> Yan, Zi
>
^ permalink raw reply [flat|nested] 34+ messages in thread
end of thread, other threads:[~2026-03-16 3:51 UTC | newest]
Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-12 11:40 [PATCH 0/4] selftests/mm: skip several tests when thp is not available Chunyu Hu
2026-03-12 11:40 ` [RESEND PATCH 1/4] selftests/mm/guard-regions: skip collapse test when thp not enabled Chunyu Hu
2026-03-12 13:58 ` Zi Yan
2026-03-12 19:48 ` David Hildenbrand (Arm)
2026-03-13 15:35 ` Lorenzo Stoakes (Oracle)
2026-03-12 11:40 ` [RESEND PATCH 2/4] selftests/mm: soft-dirty: skip two tests when thp is not available Chunyu Hu
2026-03-12 14:00 ` Zi Yan
2026-03-12 19:43 ` David Hildenbrand (Arm)
2026-03-13 17:37 ` Lorenzo Stoakes (Oracle)
2026-03-12 11:40 ` [RESEND PATCH 3/4] selftests/mm: split_huge_page_test: skip the test " Chunyu Hu
2026-03-12 14:11 ` Zi Yan
2026-03-13 2:29 ` Chunyu Hu
2026-03-13 15:15 ` Mike Rapoport
2026-03-13 15:27 ` Zi Yan
2026-03-13 18:00 ` Lorenzo Stoakes (Oracle)
2026-03-16 3:51 ` Chunyu Hu
2026-03-16 3:46 ` Chunyu Hu
2026-03-12 19:44 ` David Hildenbrand (Arm)
2026-03-13 2:25 ` Chunyu Hu
2026-03-12 11:40 ` [RESEND PATCH 4/4] selftests/mm: transhuge_stress: skip the test when thp " Chunyu Hu
2026-03-12 14:11 ` Zi Yan
2026-03-12 19:46 ` David Hildenbrand (Arm)
2026-03-13 2:43 ` Chunyu Hu
2026-03-13 18:01 ` Lorenzo Stoakes (Oracle)
2026-03-12 14:03 ` [PATCH 0/4] selftests/mm: skip several tests when thp is " Mike Rapoport
2026-03-13 0:26 ` Chunyu Hu
2026-03-13 15:19 ` Mike Rapoport
2026-03-13 15:40 ` Lorenzo Stoakes (Oracle)
2026-03-14 0:22 ` Chunyu Hu
2026-03-14 0:27 ` Chunyu Hu
2026-03-12 19:39 ` David Hildenbrand (Arm)
2026-03-13 2:21 ` Chunyu Hu
-- strict thread matches above, loose matches on Subject: below --
2026-03-12 11:26 Chunyu Hu
2026-03-12 11:35 ` Chunyu Hu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox