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

Wilco Dijkstra Wilco.Dijkstra@arm.com
Thu Aug 14 16:31:21 GMT 2025


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?

Cheers,
Wilco


More information about the Libc-alpha mailing list