Re: [PATCH v4 01/13] mm: hugetlb_vmemmap: fix OOM during head page allocation

From: Oscar Salvador (SUSE)

Date: Sat Nov 07 2026 - 12:16:41 EST


On Sat, Nov 07, 2026 at 10:27:44AM +0800, Muchun Song wrote:
> From: Yili Zhang <zhangyili01@xxxxxxxxx>
>
> The head page used during HugeTLB vmemmap optimization is allocated with
> a bare GFP_KERNEL mask. When boot-time hugepage allocation drains free
> memory, parallel optimization workers can enter OOM handling before
> userspace exists, leaving the kernel with no killable process and causing
> a panic.
>
> hugetlb_pages_alloc_boot_node() invokes HVO on the folios accumulated so
> far when available memory reaches zero, allowing the released vmemmap pages
> to support further hugepage allocations. If allocating the HVO head page
> returns -ENOMEM, the bulk HVO path frees any vmemmap pages it has already
> accumulated and retries, while callers can continue with an unoptimized
> folio if the retry still fails. Therefore, neither an allocation warning
> nor OOM handling helps this best-effort allocation. Use GFP_KERNEL |
> __GFP_NOWARN | __GFP_RETRY_MAYFAIL to allow reclaim retries while avoiding
> both.
>
> Fixes: c0b495b91a47 ("mm/hugetlb: refactor code around vmemmap_walk")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Yili Zhang <zhangyili01@xxxxxxxxx>
> Co-developed-by: Muchun Song <songmuchun@xxxxxxxxxxxxx>
> Signed-off-by: Muchun Song <songmuchun@xxxxxxxxxxxxx>

Reviewed-by: Oscar Salvador (SUSE) <osalvador@xxxxxxxxxx>



--
Oscar Salvador
SUSE Labs