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/hugetlb: remove hugetlb_optimize_vmemmap_key static key

The hugetlb_optimize_vmemmap_key static key was used to guard fake head
detection in compound_head() and related functions. It allowed skipping
the fake head checks entirely when HVO was not in use.

With fake heads eliminated and the detection code removed, the static key
serves no purpose. Remove its definition and all increment/decrement
calls.

Link: https://lkml.kernel.org/r/20260227194302.274384-16-kas@kernel.org
Signed-off-by: Kiryl Shutsemau <kas@kernel.org>
Reviewed-by: Muchun Song <muchun.song@linux.dev>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Baoquan He <bhe@redhat.com>
Cc: Christoph Lameter <cl@gentwo.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Frank van der Linden <fvdl@google.com>
Cc: Harry Yoo <harry.yoo@oracle.com>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Usama Arif <usamaarif642@gmail.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: WANG Xuerui <kernel@xen0n.name>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Kiryl Shutsemau and committed by
Andrew Morton
da3e2d1c 01b1d0ff

+2 -14
-2
include/linux/page-flags.h
··· 221 221 return is_power_of_2(sizeof(struct page)); 222 222 } 223 223 224 - DECLARE_STATIC_KEY_FALSE(hugetlb_optimize_vmemmap_key); 225 - 226 224 static __always_inline unsigned long _compound_head(const struct page *page) 227 225 { 228 226 unsigned long info = READ_ONCE(page->compound_info);
+2 -12
mm/hugetlb_vmemmap.c
··· 385 385 return vmemmap_remap_range(start, end, &walk); 386 386 } 387 387 388 - DEFINE_STATIC_KEY_FALSE(hugetlb_optimize_vmemmap_key); 389 - EXPORT_SYMBOL(hugetlb_optimize_vmemmap_key); 390 - 391 388 static bool vmemmap_optimize_enabled = IS_ENABLED(CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP_DEFAULT_ON); 392 389 static int __init hugetlb_vmemmap_optimize_param(char *buf) 393 390 { ··· 416 419 * discarded vmemmap pages must be allocated and remapping. 417 420 */ 418 421 ret = vmemmap_remap_alloc(vmemmap_start, vmemmap_end, flags); 419 - if (!ret) { 422 + if (!ret) 420 423 folio_clear_hugetlb_vmemmap_optimized(folio); 421 - static_branch_dec(&hugetlb_optimize_vmemmap_key); 422 - } 423 424 424 425 return ret; 425 426 } ··· 539 544 if (!vmemmap_tail) 540 545 return -ENOMEM; 541 546 542 - static_branch_inc(&hugetlb_optimize_vmemmap_key); 543 - 544 547 /* 545 548 * Very Subtle 546 549 * If VMEMMAP_REMAP_NO_TLB_FLUSH is set, TLB flushing is not performed ··· 574 581 vmemmap_head, vmemmap_tail, 575 582 vmemmap_pages, flags); 576 583 out: 577 - if (ret) { 578 - static_branch_dec(&hugetlb_optimize_vmemmap_key); 584 + if (ret) 579 585 folio_clear_hugetlb_vmemmap_optimized(folio); 580 - } 581 586 582 587 return ret; 583 588 } ··· 641 650 register_page_bootmem_memmap(pfn_to_section_nr(spfn), 642 651 &folio->page, 643 652 HUGETLB_VMEMMAP_RESERVE_SIZE); 644 - static_branch_inc(&hugetlb_optimize_vmemmap_key); 645 653 continue; 646 654 } 647 655