Re: [PATCH] mm/hugetlb: allow overcommitting gigantic hugepages
From: Usama Arif
Date: Tue Oct 07 2025 - 18:52:50 EST
On 07/10/2025 23:24, Andrew Morton wrote:
> On Mon, 6 Oct 2025 19:56:07 +0100 Usama Arif <usamaarif642@xxxxxxxxx> wrote:
>
>> Currently, gigantic hugepages cannot use the overcommit mechanism
>> (nr_overcommit_hugepages), forcing users to permanently reserve memory via
>> nr_hugepages even when pages might not be actively used.
>>
>
> Why did we do that? Just an oversight?
I believe this restriction was added in 2011 [1], which was before there was support for reserving
1G hugepages at runtime. Once that was added, I think we forgot to remove this restriction.
[1] https://git.zx2c4.com/linux-rng/commit/mm/hugetlb.c?id=adbe8726dc2a3805630d517270db17e3af86e526
>
>> - if (hstate_is_gigantic(h))
>> + if (hstate_is_gigantic(h) && !gigantic_page_runtime_supported())
>
>> - if (hstate_is_gigantic(h))
>> + if (hstate_is_gigantic(h) && !gigantic_page_runtime_supported())
>
>> - if (write && hstate_is_gigantic(h))
>> + if (write && hstate_is_gigantic(h) && !gigantic_page_runtime_supported())
>
> Maybe a little helper for this?
>
> (Little helpers are nice sites for code comments!)
Will add this in the next revision, Along with a paragraph about the history
of why this restriction existed in the first place.
Thanks for the review!
Usama