[PATCH v3 4/4] mm/mm_init: Fix pageblock migratetype for ZONE_DEVICE compound pages
Oscar Salvador
osalvador at suse.de
Tue Apr 21 17:29:43 AEST 2026
On Tue, Apr 21, 2026 at 02:54:35PM +0800, Muchun Song wrote:
>
>
> > On Apr 21, 2026, at 12:15, Oscar Salvador <osalvador at suse.de> wrote:
> >
> > On Tue, Apr 21, 2026 at 10:20:44AM +0800, 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.
> >>
> >> Fixes: c4386bd8ee3a ("mm/memremap: add ZONE_DEVICE support for compound pages")
> >> Signed-off-by: Muchun Song <songmuchun at bytedance.com>
> >> Reviewed-by: Mike Rapoport (Microsoft) <rppt at kernel.org>
Reviewed-by: Oscar Salvador <osalvador at suse.de>
> > Would not the call to __init_zone_device_page() from
> > memmap_init_compound() take care of the subsequent pageblocks?
> >
>
> No, it won't handle them automatically, as the page count from
> compound_nr_pages doesn't cover the following pageblocks.
Ok, I see.
--
Oscar Salvador
SUSE Labs
More information about the Linuxppc-dev
mailing list