On 02.09.25 10:16, Wei Yang wrote:
On Mon, Sep 01, 2025 at 09:10:57PM +0200, David Hildenbrand wrote: [...]
diff --git a/tools/testing/selftests/mm/split_huge_page_test.c b/tools/testing/selftests/mm/split_huge_page_test.c index 10ae65ea032f6..aa0f0502efa06 100644 --- a/tools/testing/selftests/mm/split_huge_page_test.c +++ b/tools/testing/selftests/mm/split_huge_page_test.c @@ -390,67 +390,88 @@ static void split_pmd_thp_to_order(int order) static void split_pte_mapped_thp(void) {
- char *one_page, *pte_mapped, *pte_mapped2;
- size_t len = 4 * pmd_pagesize;
- uint64_t thp_size;
- const size_t nr_thps = 4;
- const size_t thp_area_size = nr_thps * pmd_pagesize;
- const size_t page_area_size = nr_thps * pagesize;
- char *thp_area, *page_area = NULL, *tmp; size_t i;
- one_page = mmap((void *)(1UL << 30), len, PROT_READ | PROT_WRITE,
- thp_area = mmap((void *)(1UL << 30), thp_area_size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
- if (one_page == MAP_FAILED)
ksft_exit_fail_msg("Fail to allocate memory: %s\n", strerror(errno));
- if (thp_area == MAP_FAILED) {
ksft_test_result_fail("Fail to allocate memory: %s\n", strerror(errno));
goto out;
- }
- madvise(one_page, len, MADV_HUGEPAGE);
- madvise(thp_area, thp_area_size, MADV_HUGEPAGE);
- for (i = 0; i < len; i++)
one_page[i] = (char)i;
- for (i = 0; i < thp_area_size; i++)
thp_area[i] = (char)i;
- if (!check_huge_anon(one_page, 4, pmd_pagesize))
ksft_exit_fail_msg("No THP is allocated\n");
- if (!check_huge_anon(thp_area, nr_thps, pmd_pagesize)) {
ksft_test_result_skip("Not all THPs allocated\n");
Not sure why we skip here?
We usually don't want tests to fail simply because our memory is fragmented.
If I'm going to send this I'll comment on all changes in the patch description.
[...]
- /* Split failed? */
- for (i = 0; i < nr_thps; i++) {
if (is_backed_by_folio(&page_area[i], 0, pagemap_fd, kpageflags_fd))
I guess we want to check (page_area + i * pagesize) here?
yes!