]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
selftests/mm: do check_huge_anon() with a number been passed in
authorWei Yang <richard.weiyang@gmail.com>
Sat, 9 Aug 2025 19:42:09 +0000 (19:42 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 18 Aug 2025 05:08:35 +0000 (22:08 -0700)
Currently it hard codes the number of hugepage to check for
check_huge_anon(), but it would be more reasonable to do the check based
on a number passed in.

Pass in the hugepage number and do the check based on it.

Link: https://lkml.kernel.org/r/20250809194209.30484-1-richard.weiyang@gmail.com
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Reviewed by: Donet Tom <donettom@linux.ibm.com>
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Zi Yan <ziy@nvidia.com>
Reviewed-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
Reviewed-by: wang lian <lianux.mm@gmail.com>
Cc: Dev Jain <dev.jain@arm.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/selftests/mm/split_huge_page_test.c

index cc8dff080d7e86f73635a592f7e65182a9f3f631..eadbeb820d710fe59deb6aec3e1031b97ab3492d 100644 (file)
@@ -106,12 +106,12 @@ static char *allocate_zero_filled_hugepage(size_t len)
        return result;
 }
 
-static void verify_rss_anon_split_huge_page_all_zeroes(char *one_page, size_t len)
+static void verify_rss_anon_split_huge_page_all_zeroes(char *one_page, int nr_hpages, size_t len)
 {
        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();
@@ -142,7 +142,7 @@ void split_pmd_zero_pages(void)
        size_t len = nr_hpages * pmd_pagesize;
 
        one_page = allocate_zero_filled_hugepage(len);
-       verify_rss_anon_split_huge_page_all_zeroes(one_page, len);
+       verify_rss_anon_split_huge_page_all_zeroes(one_page, nr_hpages, len);
        ksft_test_result_pass("Split zero filled huge pages successful\n");
        free(one_page);
 }