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.

hugetlb: optimise hugetlb_folio_init_tail_vmemmap()

Extract the zone number directly from the folio instead of using the
folio's zone number to look up the zone and asking the zone what its
number is.

Also we should use &folio->page instead of casting from folio to page

Link: https://lkml.kernel.org/r/20251106201452.2292631-1-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: David Hildenbrand <david@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Matthew Wilcox (Oracle) and committed by
Andrew Morton
e24f66e8 135e541a

+2 -2
+2 -2
mm/hugetlb.c
··· 3246 3246 unsigned long start_page_number, 3247 3247 unsigned long end_page_number) 3248 3248 { 3249 - enum zone_type zone = zone_idx(folio_zone(folio)); 3249 + enum zone_type zone = folio_zonenum(folio); 3250 3250 int nid = folio_nid(folio); 3251 3251 struct page *page = folio_page(folio, start_page_number); 3252 3252 unsigned long head_pfn = folio_pfn(folio); ··· 3279 3279 ret = folio_ref_freeze(folio, 1); 3280 3280 VM_BUG_ON(!ret); 3281 3281 hugetlb_folio_init_tail_vmemmap(folio, 1, nr_pages); 3282 - prep_compound_head((struct page *)folio, huge_page_order(h)); 3282 + prep_compound_head(&folio->page, huge_page_order(h)); 3283 3283 } 3284 3284 3285 3285 static bool __init hugetlb_bootmem_page_prehvo(struct huge_bootmem_page *m)