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) <[email protected]>
Suggested-by: Zi Yan <[email protected]>
Signed-off-by: Yeoreum Yun <[email protected]>
---

LGTM, with comments from Lorenzo and Zi addressed.

Reviewed-by: Baolin Wang <[email protected]>
Tested-by: Baolin Wang <[email protected]>

Reply via email to