[PATCH v2 0/4] malloc: Improve Huge Page support

Guillaume Morin guillaume@morinfr.org
Thu Aug 19 16:42:17 GMT 2021


Hi Adhemerval,

On 18 Aug 11:19, Adhemerval Zanella wrote:
> Linux currently supports two ways to use Huge Pages: either by using
> specific flags directly with the syscall (MAP_HUGETLB for mmap(), or
> SHM_HUGETLB for shmget()), or by using Transparent Huge Pages (THP)
> where the kernel will try to move allocated anonymous pages to Huge
> Pages blocks transparent to application.

This approach looks good to me! This is much appreciated.

Are you planning on tackling using the same tunables to allocate
additional heaps (in arena.c)?

It's a little more subtle because of the calls to mprotect() which needs
to be properly aligned for hugetlbfs, and probably for THP as well (to
avoid un-necessary page splitting).

One additional thing to address is the case where mmap() fails with
MAP_HUGETLB because HP allocation fails.  Reverting to the default pages
will match what libhugetlbfs does (i.e just call mmap() again without
MAP_HUGETLB). But I see that Siddhesh and you have already been
discussing this case.

Guillaume.

-- 
Guillaume Morin <guillaume@morinfr.org>


More information about the Libc-alpha mailing list