]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mm/hugetlb: remove hugetlb_optimize_vmemmap_key static key
authorKiryl Shutsemau <kas@kernel.org>
Fri, 27 Feb 2026 19:42:53 +0000 (19:42 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 5 Apr 2026 20:53:09 +0000 (13:53 -0700)
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>
include/linux/page-flags.h
mm/hugetlb_vmemmap.c

index b8eef2181598d19361a60efd9052ca3e2421606d..f361bd6c814c20d099c590e5be2b2306a41d2fcd 100644 (file)
@@ -221,8 +221,6 @@ static __always_inline bool compound_info_has_mask(void)
        return is_power_of_2(sizeof(struct page));
 }
 
-DECLARE_STATIC_KEY_FALSE(hugetlb_optimize_vmemmap_key);
-
 static __always_inline unsigned long _compound_head(const struct page *page)
 {
        unsigned long info = READ_ONCE(page->compound_info);
index fd1d5d5d12b4621065ef6eeec2558cdd7dc0638b..4a077d231d3a2cb12d8ed56e8cefbfec41dcf5f5 100644 (file)
@@ -385,9 +385,6 @@ static int vmemmap_remap_alloc(unsigned long start, unsigned long end,
        return vmemmap_remap_range(start, end, &walk);
 }
 
-DEFINE_STATIC_KEY_FALSE(hugetlb_optimize_vmemmap_key);
-EXPORT_SYMBOL(hugetlb_optimize_vmemmap_key);
-
 static bool vmemmap_optimize_enabled = IS_ENABLED(CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP_DEFAULT_ON);
 static int __init hugetlb_vmemmap_optimize_param(char *buf)
 {
@@ -419,10 +416,8 @@ static int __hugetlb_vmemmap_restore_folio(const struct hstate *h,
         * discarded vmemmap pages must be allocated and remapping.
         */
        ret = vmemmap_remap_alloc(vmemmap_start, vmemmap_end, flags);
-       if (!ret) {
+       if (!ret)
                folio_clear_hugetlb_vmemmap_optimized(folio);
-               static_branch_dec(&hugetlb_optimize_vmemmap_key);
-       }
 
        return ret;
 }
@@ -544,8 +539,6 @@ static int __hugetlb_vmemmap_optimize_folio(const struct hstate *h,
        if (!vmemmap_tail)
                return -ENOMEM;
 
-       static_branch_inc(&hugetlb_optimize_vmemmap_key);
-
        /*
         * Very Subtle
         * If VMEMMAP_REMAP_NO_TLB_FLUSH is set, TLB flushing is not performed
@@ -581,10 +574,8 @@ static int __hugetlb_vmemmap_optimize_folio(const struct hstate *h,
                                 vmemmap_head, vmemmap_tail,
                                 vmemmap_pages, flags);
 out:
-       if (ret) {
-               static_branch_dec(&hugetlb_optimize_vmemmap_key);
+       if (ret)
                folio_clear_hugetlb_vmemmap_optimized(folio);
-       }
 
        return ret;
 }
@@ -650,7 +641,6 @@ static void __hugetlb_vmemmap_optimize_folios(struct hstate *h,
                        register_page_bootmem_memmap(pfn_to_section_nr(spfn),
                                        &folio->page,
                                        HUGETLB_VMEMMAP_RESERVE_SIZE);
-                       static_branch_inc(&hugetlb_optimize_vmemmap_key);
                        continue;
                }