Re: [PATCH v5 v5 5/6] mm/mm_init: Fix pageblock migratetype for ZONE_DEVICE compound pages

David Hildenbrand (Arm)
2026-04-23T10:41:10Z

On 4/23/26 09:19, Muchun Song wrote:
> The memmap_init_zone_device() function only initializes the migratetype
> of the first pageblock of a compound page. If the compound page size
> exceeds pageblock_nr_pages (e.g., 1GB hugepages with 2MB pageblocks),
> subsequent pageblocks in the compound page remain uninitialized.
>
> Move the migratetype initialization out of __init_zone_device_page()
> and into a separate pageblock_migratetype_init_range() function. This
> iterates over the entire PFN range of the memory, ensuring that all
> pageblocks are correctly initialized.
>
> Also remove the stale confusing comment about MEMINIT_HOTPLUG above
> the migratetype setting since it is an obsolete relic from commit
> 966cf44f637e ("mm: defer ZONE_DEVICE page initialization to the point
> where we init pgmap") and no longer makes sense here.
>
> Fixes: c4386bd8ee3a ("mm/memremap: add ZONE_DEVICE support for compound pages")
> Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> Reviewed-by: Oscar Salvador <osalvador@suse.de>
> ---

Acked-by: David Hildenbrand (Arm) <david@kernel.org>

--
Cheers,

David