Re: [PATCH v5] mm, hugetlb: implement movable_gigantic_pages sysctl
From: David Rientjes
Date: Wed Dec 24 2025 - 16:45:34 EST
On Sun, 21 Dec 2025, Gregory Price wrote:
> This reintroduces a concept removed by:
> commit d6cb41cc44c6 ("mm, hugetlb: remove hugepages_treat_as_movable sysctl")
>
> This sysctl provides flexibility between ZONE_MOVABLE use cases:
> 1) onlining memory in ZONE_MOVABLE to maintain hotplug compatibility
> 2) onlining memory in ZONE_MOVABLE to make hugepage allocate reliable
>
> When ZONE_MOVABLE is used to make huge page allocation more reliable,
> disallowing gigantic pages memory in this region is pointless. If
> hotplug is not a requirement, we can loosen the restrictions to allow
> 1GB gigantic pages in ZONE_MOVABLE.
>
> Since 1GB can be difficult to migrate / has impacts on compaction /
> defragmentation, we don't enable this by default. Notably, 1GB pages
> can only be migrated if another 1GB page is available - so hot-unplug
> will fail if such a page cannot be found.
>
> However, since there are scenarios where gigantic pages are migratable,
> we should allow use of these on movable regions.
>
> When not valid 1GB is available for migration, hot-unplug will retry
> indefinitely (or until interrupted). For example:
>
> echo 0 > node0/hugepages/..-1GB/nr_hugepages # clear node0 1GB pages
> echo 1 > node1/hugepages/..-1GB/nr_hugepages # reserve node1 1GB page
> ./alloc_huge_node1 & # Allocate a 1GB page on node1
> ./node1_offline & # attempt to offline all node1 memory
> echo 1 > node0/hugepages/..-1GB/nr_hugepages # reserve node0 1GB page
>
> In this example, node1_offline will block indefinitely until the final
> step, when a node0 1GB page is made available.
>
> Note: Boot-time CMA is not possible for driver-managed hotplug memory,
> as CMA requires the memory to be registered as SystemRAM at boot time.
> Additionally, 1GB huge pages are not supported by THP.
>
> Cc: David Hildenbrand <david@xxxxxxxxxx>
> Cc: Mel Gorman <mgorman@xxxxxxx>
> Cc: Michal Hocko <mhocko@xxxxxxxx>
> Suggested-by: David Rientjes <rientjes@xxxxxxxxxx>
> Signed-off-by: Gregory Price <gourry@xxxxxxxxxx>
> Link: https://lore.kernel.org/all/20180201193132.Hk7vI_xaU%25akpm@xxxxxxxxxxxxxxxxxxxx/
Acked-by: David Rientjes <rientjes@xxxxxxxxxx>
Thanks for pursuing this, Gregory.