Re: [PATCH v3 5/5] mm/memory-failure: efi: replay the poisioned page in the next kernel

From: Kiryl Shutsemau

Date: Fri Aug 28 2026 - 10:37:22 EST


On Wed, Aug 26, 2026 at 05:03:56AM -0700, Breno Leitao wrote:
> diff --git a/mm/mm_init.c b/mm/mm_init.c
> index ddda9d6837f32..f94fa221da0b8 100644
> --- a/mm/mm_init.c
> +++ b/mm/mm_init.c
> @@ -2667,6 +2667,7 @@ void __init mm_core_init(void)
> kho_memory_init();
>
> memblock_free_all();
> + hwpoison_init_boot();
> mem_init();
> kmem_cache_init();
> /*

I don't think it works with deferred page init.

With CONFIG_DEFERRED_STRUCT_PAGE_INIT the struct pages above
first_deferred_pfn are not initialized here. memmap_init_range() breaks
out at defer_init() and the rest is done by page_alloc_init_late(), way
past this point.

But I think the shape is wrong here, not just the placement. We should
flag poisoned pages on the first add to buddy, not after the buddy is
initialized.

__free_pages_core() already consults the unaccepted table. Adding youre
case there seems logical. And all three paths -- memblock_free_pages(),
deferred_free_pages() and generic_online_page() -- gets there.
No need in special-casing for deferred page init.

It also closes the window where the page allocator is live before the
frames are taken out of it.

And patch 4 seems to be redundant in such shape.

--
Kiryl Shutsemau / Kirill A. Shutemov