Re: [PATCH v1 09/36] mm/mm_init: make memmap_init_compound() look more like prep_compound_page()
"Liam R. Howlett" <[email protected]> Thu, 28 Aug 2025 20:37:45 -0400
| Newsgroups | com.zx2c4.lists.wireguard,dev.linux.lists.iommu,dev.linux.lists.virtualization,org.freedesktop.lists.dri-devel,org.freedesktop.lists.intel-gfx,org.infradead.lists.linux-arm-kernel,org.infradead.lists.linux-riscv,org.kernel.vger.io-uring,org.kernel.vger.kvm,org.kernel.vger.linux-crypto,org.kernel.vger.linux-ide,org.kernel.vger.linux-kernel,org.kernel.vger.linux-kselftest,org.kernel.vger.linux-mips,org.kernel.vger.linux-mmc,org.kernel.vger.linux-s390,org.kernel.vger.linux-scsi,org.kernel.vger.netdev,org.kvack.linux-mm |
|---|---|
| Message-ID | <acgtr3jhbauka3qsov64y635rnw7elmyh5c6w3fvfvk4qnicvo@ybv7i5bzbvd2> |
* David Hildenbrand <[email protected]> [250827 18:05]: > Grepping for "prep_compound_page" leaves on clueless how devdax gets its > compound pages initialized. > > Let's add a comment that might help finding this open-coded > prep_compound_page() initialization more easily. Thanks for the comment here. > > Further, let's be less smart about the ordering of initialization and just > perform the prep_compound_head() call after all tail pages were > initialized: just like prep_compound_page() does. > > No need for a comment to describe the initialization order: again, > just like prep_compound_page(). > > Reviewed-by: Mike Rapoport (Microsoft) <[email protected]> > Signed-off-by: David Hildenbrand <[email protected]> Acked-by: Liam R. Howlett <[email protected]> > --- > mm/mm_init.c | 15 +++++++-------- > 1 file changed, 7 insertions(+), 8 deletions(-) > > diff --git a/mm/mm_init.c b/mm/mm_init.c > index 5c21b3af216b2..df614556741a4 100644 > --- a/mm/mm_init.c > +++ b/mm/mm_init.c > @@ -1091,6 +1091,12 @@ static void __ref memmap_init_compound(struct page *head, > unsigned long pfn, end_pfn = head_pfn + nr_pages; > unsigned int order = pgmap->vmemmap_shift; > > + /* > + * We have to initialize the pages, including setting up page links. > + * prep_compound_page() does not take care of that, so instead we > + * open-code prep_compound_page() so we can take care of initializing > + * the pages in the same go. > + */ > __SetPageHead(head); > for (pfn = head_pfn + 1; pfn < end_pfn; pfn++) { > struct page *page = pfn_to_page(pfn); > @@ -1098,15 +1104,8 @@ static void __ref memmap_init_compound(struct page *head, > __init_zone_device_page(page, pfn, zone_idx, nid, pgmap); > prep_compound_tail(head, pfn - head_pfn); > set_page_count(page, 0); > - > - /* > - * The first tail page stores important compound page info. > - * Call prep_compound_head() after the first tail page has > - * been initialized, to not have the data overwritten. > - */ > - if (pfn == head_pfn + 1) > - prep_compound_head(head, order); > } > + prep_compound_head(head, order); > } > > void __ref memmap_init_zone_device(struct zone *zone, > -- > 2.50.1 >