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

"Li Zhe" <[email protected]>
Newsgroups org.kernel.vger.linux-arch,org.kernel.vger.linux-hardening,org.kernel.vger.linux-kernel,org.kvack.linux-mm
Message-ID <[email protected]>
On Tue, 7 Jul 2026 13:09:01 +1000, [email protected] 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.