Re: [PATCH v2 4/7] mm: extend the template fast path to zone-device compound tails

From: Li Zhe

Date: Mon May 25 2026 - 00:12:27 EST


On Sat, 23 May 2026 15:10:52 +0300, rppt@xxxxxxxxxx wrote:

> On Thu, 21 May 2026 12:01:21 +0800, Li Zhe <lizhe.67@xxxxxxxxxxxxx> wrote:
> > diff --git a/mm/mm_init.c b/mm/mm_init.c
> > index 2992711351a0..17a84d4cda01 100644
> > --- a/mm/mm_init.c
> > +++ b/mm/mm_init.c
> > @@ -1084,17 +1084,25 @@ static inline bool zone_device_page_init_optimization_enabled(void)
> > IS_ALIGNED(sizeof(struct page), sizeof(u64));
> > }
> >
> > -static inline void zone_device_template_page_init(struct page *template,
> > - unsigned long pfn,
> > - unsigned long zone_idx,
> > - int nid,
> > - struct dev_pagemap *pgmap)
> > +static inline void zone_device_template_head_page_init(struct page *template,
> > + unsigned long pfn, unsigned long zone_idx, int nid,
> > + struct dev_pagemap *pgmap)
>
> Yeah, two tabs from the start would be better :)
>
> > @@ -1156,12 +1166,28 @@ static void __ref memmap_init_compound(struct page *head,
> > [ ... skip 17 lines ... ]
> > - zone_device_page_init_slow(page, pfn, zone_idx, nid, pgmap);
> > - prep_compound_tail(page, head, order);
> > - set_page_count(page, 0);
> > + if (use_template) {
> > + zone_device_page_init_from_template(page, pfn,
> > + &template);
>
> continue here and there won't be need to indent the slow path.
>
> Reviewed-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>

Thanks for the review. I will fix this in the next revision.

Thanks,
Zhe