Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/mm_init: make memmap_init_compound() look more like prep_compound_page()

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.

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().

Link: https://lkml.kernel.org/r/20250901150359.867252-10-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Reviewed-by: Wei Yang <richard.weiyang@gmail.com>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Acked-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

David Hildenbrand and committed by
Andrew Morton
50765b46 7b4f21f5

+7 -8
+7 -8
mm/mm_init.c
··· 1091 1091 unsigned long pfn, end_pfn = head_pfn + nr_pages; 1092 1092 unsigned int order = pgmap->vmemmap_shift; 1093 1093 1094 + /* 1095 + * We have to initialize the pages, including setting up page links. 1096 + * prep_compound_page() does not take care of that, so instead we 1097 + * open-code prep_compound_page() so we can take care of initializing 1098 + * the pages in the same go. 1099 + */ 1094 1100 __SetPageHead(head); 1095 1101 for (pfn = head_pfn + 1; pfn < end_pfn; pfn++) { 1096 1102 struct page *page = pfn_to_page(pfn); ··· 1104 1098 __init_zone_device_page(page, pfn, zone_idx, nid, pgmap); 1105 1099 prep_compound_tail(head, pfn - head_pfn); 1106 1100 set_page_count(page, 0); 1107 - 1108 - /* 1109 - * The first tail page stores important compound page info. 1110 - * Call prep_compound_head() after the first tail page has 1111 - * been initialized, to not have the data overwritten. 1112 - */ 1113 - if (pfn == head_pfn + 1) 1114 - prep_compound_head(head, order); 1115 1101 } 1102 + prep_compound_head(head, order); 1116 1103 } 1117 1104 1118 1105 void __ref memmap_init_zone_device(struct zone *zone,