[PATCH] malloc: Fix tst bug in malloc/tst-free-errno-malloc-hugetlb1.

Wilco Dijkstra Wilco.Dijkstra@arm.com
Mon Aug 18 09:46:48 GMT 2025


Hi caiyinyu,

在 2025/8/15 上午12:31, Wilco Dijkstra 写道:
> Hi caiyinyu,
>
>> When transparent hugepages (THP) are configured to 32MB on x86/loongarch
>> systems, the current big_size value may not be sufficiently large to
>> guarantee that free(ptr) [1] will call munmap(ptr_aligned, big_size).
> LGTM, and passes on AArch64 too.
>
> Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
>
>> PS: Without this patch and using 32M THP, there is a about 50% chance
>> that malloc/tst-free-errno-malloc-hugetlb1 will fail on both x86_64 and
>> loongarch64.
> I'm surprised it is affected by THP. It should always use munmap since the default
> threshold does not change. But I guess somehow munmap doesn't run out of
> mmap areas?

> Thank you for your review and feedback.
>
> Should we include this patch?

Yes it looks fine to me. The reviewed-by means you can commit it. Do you have
commit rights?

Cheers,
Wilco


More information about the Libc-alpha mailing list