Re: [PATCH] mm/hugetlb: allow overcommitting gigantic hugepages

From: Andrew Morton

Date: Tue Oct 07 2025 - 18:24:30 EST


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?

> - 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!)