Skip to contentSkip to conversation

selftests/mm: do check_huge_anon() with a number been passed in

PATCH Superseded Wei Yang 8 participants 12 messages Aug 7, 2025 – Aug 11, 2025

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Wei Yang

author
#0 lore raw

PATCH 1/1 selftests/mm: do check_huge_anon() with a number been passed in

Currently it hard coded the number of hugepage to check for check_huge_anon(), but we already have the number passed in.

Do the check based on the number of hugepage passed in is more reasonable.

---
 tools/testing/selftests/mm/split_huge_page_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/mm/split_huge_page_test.c +1 -1
index 44a3f8a58806..bf40e6b121ab 100644
@@ -111,7 +111,7 @@ static void verify_rss_anon_split_huge_page_all_zeroes(char *one_page, int nr_hp
 	unsigned long rss_anon_before, rss_anon_after;
 	size_t i;
 
-	if (!check_huge_anon(one_page, 4, pmd_pagesize))
+	if (!check_huge_anon(one_page, nr_hpages, pmd_pagesize))
 		ksft_exit_fail_msg("No THP is allocated\n");
 
 	rss_anon_before = rss_anon();
Signature · 1 line
2.34.1
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Wei Yang

Currently it hard coded the number of hugepage to check for check_huge_anon(), but we already have the number passed in.

Do the check based on the number of hugepage passed in is more reasonable.

---

Yes. LGTM.

Quoted 16 lines
  tools/testing/selftests/mm/split_huge_page_test.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/mm/split_huge_page_test.c +1 -1
index 44a3f8a58806..bf40e6b121ab 100644
@@ -111,7 +111,7 @@ static void verify_rss_anon_split_huge_page_all_zeroes(char *one_page, int nr_hp
  	unsigned long rss_anon_before, rss_anon_after;
  	size_t i;
 
-	if (!check_huge_anon(one_page, 4, pmd_pagesize))
+	if (!check_huge_anon(one_page, nr_hpages, pmd_pagesize))
  		ksft_exit_fail_msg("No THP is allocated\n");
 
  	rss_anon_before = rss_anon();
Reviewed-by on v1 1/1
#2 lore raw
In reply to Wei Yang
Quoted 16 lines · Wei Yang

Currently it hard coded the number of hugepage to check for check_huge_anon(), but we already have the number passed in.

Do the check based on the number of hugepage passed in is more reasonable.

---
  tools/testing/selftests/mm/split_huge_page_test.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/mm/split_huge_page_test.c +0 -0
index 44a3f8a58806..bf40e6b121ab 100644

tools/testing/selftests/mm/split_huge_page_test.c static void verify_rss_anon_split_huge_page_all_zeroes(char *one_page, int nr_hp · line 117

Quoted 8 lines
tools/testing/selftests/mm/split_huge_page_test.c +1 -1
@@ -111,7 +111,7 @@ static void verify_rss_anon_split_huge_page_all_zeroes(char *one_page, int nr_hp
  	unsigned long rss_anon_before, rss_anon_after;
  	size_t i;
 
-	if (!check_huge_anon(one_page, 4, pmd_pagesize))
+	if (!check_huge_anon(one_page, nr_hpages, pmd_pagesize))
  		ksft_exit_fail_msg("No THP is allocated\n");
 
  	rss_anon_before = rss_anon();

LGTM

reviewer
#5 lore raw
In reply to Wei Yang
Quoted 16 lines · Wei Yang

Currently it hard coded the number of hugepage to check for check_huge_anon(), but we already have the number passed in.

Do the check based on the number of hugepage passed in is more reasonable.

---
 tools/testing/selftests/mm/split_huge_page_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/mm/split_huge_page_test.c +0 -0
index 44a3f8a58806..bf40e6b121ab 100644

tools/testing/selftests/mm/split_huge_page_test.c static void verify_rss_anon_split_huge_page_all_zeroes(char *one_page, int nr_hp · line 117

Quoted 8 lines
tools/testing/selftests/mm/split_huge_page_test.c +1 -1
@@ -111,7 +111,7 @@ static void verify_rss_anon_split_huge_page_all_zeroes(char *one_page, int nr_hp
 	unsigned long rss_anon_before, rss_anon_after;
 	size_t i;
 
-	if (!check_huge_anon(one_page, 4, pmd_pagesize))
+	if (!check_huge_anon(one_page, nr_hpages, pmd_pagesize))
 		ksft_exit_fail_msg("No THP is allocated\n");
 
 	rss_anon_before = rss_anon();

Which commit is this patch based on?

In mm-new[1], verify_rss_anon_split_huge_page_all_zeroes() accepts char *one_page and size_t len but no nr_hpages. This breaks split_huge_page_test.c compilation.

Are you forgetting some cleanup patches before this one?

[1] https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git/tree/tools/testing/selftests/mm/split_huge_page_test.c?h=mm-new#n110

Hi Andrew,

Can you drop this one for now? Thanks.

--
Best Regards,
Yan, Zi

reviewer
#6 lore raw
Quoted 33 lines · Zi Yan
Quoted 16 lines · Wei Yang

Currently it hard coded the number of hugepage to check for check_huge_anon(), but we already have the number passed in.

Do the check based on the number of hugepage passed in is more reasonable.

---
 tools/testing/selftests/mm/split_huge_page_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/mm/split_huge_page_test.c +0 -0
index 44a3f8a58806..bf40e6b121ab 100644

tools/testing/selftests/mm/split_huge_page_test.c static void verify_rss_anon_split_huge_page_all_zeroes(char *one_page, int nr_hp · line 117

Quoted 8 lines
tools/testing/selftests/mm/split_huge_page_test.c +1 -1
@@ -111,7 +111,7 @@ static void verify_rss_anon_split_huge_page_all_zeroes(char *one_page, int nr_hp
 	unsigned long rss_anon_before, rss_anon_after;
 	size_t i;
 
-	if (!check_huge_anon(one_page, 4, pmd_pagesize))
+	if (!check_huge_anon(one_page, nr_hpages, pmd_pagesize))
 		ksft_exit_fail_msg("No THP is allocated\n");
 
 	rss_anon_before = rss_anon();

Which commit is this patch based on?

In mm-new[1], verify_rss_anon_split_huge_page_all_zeroes() accepts char *one_page and size_t len but no nr_hpages. This breaks split_huge_page_test.c compilation.

Quoted 8 lines

Are you forgetting some cleanup patches before this one?

[1] https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git/tree/tools/testing/selftests/mm/split_huge_page_test.c?h=mm-new#n110

Hi Andrew,

Can you drop this one for now? Thanks.

Wait. It seems that mm-new is different from Linus' tree[1]. I wonder what is going on.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/testing/selftests/mm/split_huge_page_test.c?h=v6.16#n109

--
Best Regards,
Yan, Zi

reviewer
#7 lore raw
Quoted 40 lines · Zi Yan
Quoted 38 lines · Zi Yan
Quoted 16 lines · Wei Yang

Currently it hard coded the number of hugepage to check for check_huge_anon(), but we already have the number passed in.

Do the check based on the number of hugepage passed in is more reasonable.

---
 tools/testing/selftests/mm/split_huge_page_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/mm/split_huge_page_test.c +0 -0
index 44a3f8a58806..bf40e6b121ab 100644

tools/testing/selftests/mm/split_huge_page_test.c static void verify_rss_anon_split_huge_page_all_zeroes(char *one_page, int nr_hp · line 117

Quoted 8 lines
tools/testing/selftests/mm/split_huge_page_test.c +1 -1
@@ -111,7 +111,7 @@ static void verify_rss_anon_split_huge_page_all_zeroes(char *one_page, int nr_hp
 	unsigned long rss_anon_before, rss_anon_after;
 	size_t i;
 
-	if (!check_huge_anon(one_page, 4, pmd_pagesize))
+	if (!check_huge_anon(one_page, nr_hpages, pmd_pagesize))
 		ksft_exit_fail_msg("No THP is allocated\n");
 
 	rss_anon_before = rss_anon();

Which commit is this patch based on?

In mm-new[1], verify_rss_anon_split_huge_page_all_zeroes() accepts char *one_page and size_t len but no nr_hpages. This breaks split_huge_page_test.c compilation.

Are you forgetting some cleanup patches before this one?

[1] https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git/tree/tools/testing/selftests/mm/split_huge_page_test.c?h=mm-new#n110

Quoted 8 lines
Quoted 3 lines

Hi Andrew,

Can you drop this one for now? Thanks.

Wait. It seems that mm-new is different from Linus' tree[1]. I wonder what is going on.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/testing/selftests/mm/split_huge_page_test.c?h=v6.16#n109

Wei, it seems that you lost the race to Muhammad Usama Anjum's cleanup patch[1]. You might need to add nr_hpages back.

[1] https://lore.kernel.org/all/[email protected]/T/#u

--
Best Regards,
Yan, Zi

maintainer
#8 lore raw
Quoted 10 lines · On Fri, 08 Aug 2025 12:01:47 -0400 Zi Yan <[email protected]> wrote:
Quoted 4 lines

Wait. It seems that mm-new is different from Linus' tree[1]. I wonder what is going on.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/testing/selftests/mm/split_huge_page_test.c?h=v6.16#n109

Wei, it seems that you lost the race to Muhammad Usama Anjum's cleanup patch[1]. You might need to add nr_hpages back.

[1] https://lore.kernel.org/all/[email protected]/T/#u

Ah, thanks, I'll drop this version of "selftests/mm: do check_huge_anon() with a number been passed in".

author
#9 lore raw
In reply to Zi Yan
Quoted 49 lines · Zi Yan
Quoted 47 lines · Zi Yan
Quoted 33 lines · Zi Yan
Quoted 16 lines · Wei Yang

Currently it hard coded the number of hugepage to check for check_huge_anon(), but we already have the number passed in.

Do the check based on the number of hugepage passed in is more reasonable.

---
 tools/testing/selftests/mm/split_huge_page_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/mm/split_huge_page_test.c +0 -0
index 44a3f8a58806..bf40e6b121ab 100644

tools/testing/selftests/mm/split_huge_page_test.c static void verify_rss_anon_split_huge_page_all_zeroes(char *one_page, int nr_hp · line 117

Quoted 8 lines
tools/testing/selftests/mm/split_huge_page_test.c +1 -1
@@ -111,7 +111,7 @@ static void verify_rss_anon_split_huge_page_all_zeroes(char *one_page, int nr_hp
 	unsigned long rss_anon_before, rss_anon_after;
 	size_t i;
 
-	if (!check_huge_anon(one_page, 4, pmd_pagesize))
+	if (!check_huge_anon(one_page, nr_hpages, pmd_pagesize))
 		ksft_exit_fail_msg("No THP is allocated\n");
 
 	rss_anon_before = rss_anon();

Which commit is this patch based on?

In mm-new[1], verify_rss_anon_split_huge_page_all_zeroes() accepts char *one_page and size_t len but no nr_hpages. This breaks split_huge_page_test.c compilation.

Quoted 8 lines

Are you forgetting some cleanup patches before this one?

[1] https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git/tree/tools/testing/selftests/mm/split_huge_page_test.c?h=mm-new#n110

Hi Andrew,

Can you drop this one for now? Thanks.

Wait. It seems that mm-new is different from Linus' tree[1]. I wonder what is going on.

Quoted 7 lines
Quoted 1 line

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/testing/selftests/mm/split_huge_page_test.c?h=v6.16#n109

Wei, it seems that you lost the race to Muhammad Usama Anjum's cleanup patch[1]. You might need to add nr_hpages back.

[1] https://lore.kernel.org/all/[email protected]/T/#u

Thanks.

My patch is based on mm-unstable. So currently we base commit on mm-new?

Quoted 3 lines

--
Best Regards,
Yan, Zi

Signature · 2 lines
Wei Yang
Help you, Help me
#10 lore raw
In reply to Zi Yan

Yeah just hit this,

Adnrew - can we please drop this patch from mm-new for now? It's breaking the mm self tests build.

Maybe then Wei you can do a v2 rebased on current state of mm self tests?

Thanks!

Quoted 59 lines · Zi Yan
Quoted 40 lines · Zi Yan
Quoted 38 lines · Zi Yan
Quoted 16 lines · Wei Yang

Currently it hard coded the number of hugepage to check for check_huge_anon(), but we already have the number passed in.

Do the check based on the number of hugepage passed in is more reasonable.

---
 tools/testing/selftests/mm/split_huge_page_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/mm/split_huge_page_test.c +0 -0
index 44a3f8a58806..bf40e6b121ab 100644

tools/testing/selftests/mm/split_huge_page_test.c static void verify_rss_anon_split_huge_page_all_zeroes(char *one_page, int nr_hp · line 117

Quoted 8 lines
tools/testing/selftests/mm/split_huge_page_test.c +1 -1
@@ -111,7 +111,7 @@ static void verify_rss_anon_split_huge_page_all_zeroes(char *one_page, int nr_hp
 	unsigned long rss_anon_before, rss_anon_after;
 	size_t i;
 
-	if (!check_huge_anon(one_page, 4, pmd_pagesize))
+	if (!check_huge_anon(one_page, nr_hpages, pmd_pagesize))
 		ksft_exit_fail_msg("No THP is allocated\n");
 
 	rss_anon_before = rss_anon();

Which commit is this patch based on?

In mm-new[1], verify_rss_anon_split_huge_page_all_zeroes() accepts char *one_page and size_t len but no nr_hpages. This breaks split_huge_page_test.c compilation.

Are you forgetting some cleanup patches before this one?

[1] https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git/tree/tools/testing/selftests/mm/split_huge_page_test.c?h=mm-new#n110

Quoted 8 lines
Quoted 3 lines

Hi Andrew,

Can you drop this one for now? Thanks.

Wait. It seems that mm-new is different from Linus' tree[1]. I wonder what is going on.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/testing/selftests/mm/split_huge_page_test.c?h=v6.16#n109

Wei, it seems that you lost the race to Muhammad Usama Anjum's cleanup patch[1]. You might need to add nr_hpages back.

[1] https://lore.kernel.org/all/[email protected]/T/#u

--
Best Regards,
Yan, Zi

author
#11 lore raw
Quoted 7 lines · Lorenzo Stoakes

Yeah just hit this,

Adnrew - can we please drop this patch from mm-new for now? It's breaking the mm self tests build.

Maybe then Wei you can do a v2 rebased on current state of mm self tests?

Yup, v2 is on its way.

Quoted 2 lines

Thanks!

Signature · 2 lines
Wei Yang
Help you, Help me