Re: [PATCH v5 5/8] mm: extend the template fast path to zone-device compound tails

From: Li Zhe

Date: Tue Jul 07 2026 - 02:41:33 EST


On Tue, 7 Jul 2026 13:09:01 +1000, apopple@xxxxxxxxxx wrote:

> > - for (pfn = head_pfn + 1; pfn < end_pfn; pfn++) {
> > +
> > + pfn = head_pfn + 1;
> > + /*
> > + * All tails of the same compound page share the state established by
> > + * prep_compound_tail(). Reuse one tail template for the whole range and
> > + * refresh only the PFN-dependent fields in that template before each copy.
> > + */
> > + if (use_template) {
> > struct page *page = pfn_to_page(pfn);
> >
> > - zone_device_page_init_slow(page, pfn, zone_idx, nid, pgmap);
> > - prep_compound_tail(page, head, order);
> > - set_page_count(page, 0);
> > + zone_device_tail_page_init(page, pfn, zone_idx, nid,
> > + pgmap, head, order);
> > + zone_device_template_page_init(&template, page);
> > + pfn++;
>
> Similar comment as the previous patch - I think it's clearer to just init the
> template page here as a separate step and not unroll the loop.

Thanks. I will rework memmap_init_compound() the same way in v6.

Thanks,
Zhe