Re: [PATCH v3 2/2] kselftest: mm: replace usage of /proc/self/smaps for check_huge_xxx() helper
From: Yeoreum Yun
Date: Tue Sep 01 2026 - 04:11:14 EST
On Mon, Aug 31, 2026 at 03:58:18PM +0800, Baolin Wang wrote:
>
>
> On 8/28/26 4:11 PM, 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_huge_xxx()
> > helpers incorrectly require the address returned by memalign() to
> > match the VMA start address reported in /proc/self/smaps.
> >
> > Fix this by using /proc/self/pagemap and /proc/kpageflags instead of
> > /proc/self/smaps to detect huge pages.
> >
> > Reported-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
> > Suggested-by: Zi Yan <ziy@xxxxxxxxxx>
> > Signed-off-by: Yeoreum Yun <yeoreum.yun@xxxxxxx>
> > ---
>
> LGTM, with comments from Lorenzo and Zi addressed.
>
> Reviewed-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>
> Tested-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>
Thanks!
--
Sincerely,
Yeoreum Yun