On 9/21/26 20:48, Yeoreum Yun wrote:
> Hi,
> 
>> On 9/21/26 12:40, 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.
>>>
>>> Instead of relying on /proc/self/smaps, use /proc/self/pagemap and
>>> /proc/kpageflags to detect huge-page mappings and large folios:
>>>
>>>   1. If hpage_size == pmd_pagesize, check PAGE_IS_HUGE instead of
>>>      using check_large_folios(), since only the mapping type matters.
>>>      This identifies PMD-mapped huge pages.
>>>   2. Otherwise, use check_large_folios() to detect large folios. This
>>>      covers mTHP cases.
>>>   3. Check the folio flags according to the type of huge page.
>>>
>>> Since shmem pages are also file-backed, simply check whether the page
>>> is file-backed.
>>>
>>> Suggested-by: David Hildenbrand (Arm) <[email protected]>
>>> Suggested-by: Zi Yan <[email protected]>
>>
>> Do we need a Fixes: tag?
> 
> Since this change is required for the chaning of behavior of glibc,
> I don't think we don't need to add Fixes tag in here?
> 
Our test made wrong assumptions on the underlying behavior of the user space
allocator (no VMA merging would happen). So I'd argue that we should add a
Fixes: for the test.

-- 
Cheers,

David

Reply via email to