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

Adhemerval Zanella adhemerval.zanella@linaro.org
Thu Aug 19 16:55:24 GMT 2021



On 19/08/2021 13:42, Guillaume Morin wrote:
> 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).

What do you mean by additional heaps in this case?

> 
> 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.

This is what I did in my patch, it follow the current default allocation
path.



More information about the Libc-alpha mailing list