On 24 Sep 2026, at 15:11, Yeoreum Yun wrote:
> Since glibc commit 321e1fc73f (“malloc: Enable 2MB THP by default on
> AArch64”),
> glibc may call madvise(MADV_HUGEPAGE) for sufficiently large allocations
> made by memalign().
>
> The underlying VMA may start at a different address from the aligned
> address returned by memalign(). Furthermore, a subsequent
> madvise(MADV_HUGEPAGE) call does not split the VMA because the flag is
> already set.
>
> This causes split_huge_page_test to fail because the check_pmd_huge()
> helpers incorrectly require the address returned by memalign() to
> match the VMA start address reported in /proc/self/smaps.
>
> Instead of relying on /proc/self/smaps, use /proc/self/pagemap and
> /proc/kpageflags to detect huge-page mappings checking PAGE_IS_HUGE
> and PAGE_IS_FILE accroding to type of huge page.
>
> Since shmem pages are also file-backed, simply check whether the page
> is file-backed.
>
> Fixes: 642bc52aed9 ("selftests: vm: bring common functions to a new file")
> Suggested-by: David Hildenbrand (Arm) <[email protected]>
> Signed-off-by: Yeoreum Yun <[email protected]>
> ---
> tools/testing/selftests/mm/vm_util.c | 78
> ++++++++++++++++++++++--------------
> 1 file changed, 49 insertions(+), 29 deletions(-)
>
LGTM.
Acked-by: Zi Yan <[email protected]>
Best Regards,
Yan, Zi