Re: [PATCH] mm/hugetlb: init tails before init_migratetype

From: Muchun Song

Date: Mon Jun 22 2026 - 11:23:40 EST




> On Jun 22, 2026, at 18:19, Michal Clapinski <mclapinski@xxxxxxxxxx> wrote:
>
> Currently, if you enable HVO, DEFERRED_STRUCT_PAGE_INIT and VM_DEBUG
> the kernel will crash with the following stack trace
>
> get_pfnblock_bitmap_bitidx
> __set_pfnblock_flags_mask
> hugetlb_bootmem_init_migratetype
> prep_and_add_bootmem_folios
> gather_bootmem_prealloc_node
> gather_bootmem_prealloc_parallel
> padata_do_multithreaded
> gather_bootmem_prealloc
> hugetlb_init
>
> on this code
>
> VM_BUG_ON_PAGE(!zone_spans_pfn(page_zone(page), pfn), page);
>
> This code looks inside the struct page which will be uninitialized
> for hugetlb tail pages, which will cause a false positive.
>
> So let's initialize the tail pages before this happens.
>
> Fixes: 622026e87c40 ("mm/hugetlb: remove fake head pages")
> Signed-off-by: Michal Clapinski <mclapinski@xxxxxxxxxx>

Thanks for catching this! Your fix is perfectly correct and addresses
a real issue. I just wanted to let you know that a similar fix was
actually submitted a few days ago in patch [1].

[1] https://lore.kernel.org/linux-mm/20260612035903.2468601-2-songmuchun@xxxxxxxxxxxxx/

Muchun,
Thanks.