]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
Revert "mm/hugetlb: deal with multiple calls to hugetlb_bootmem_alloc"
authorMike Rapoport (Microsoft) <rppt@kernel.org>
Sun, 11 Jan 2026 08:21:03 +0000 (10:21 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 27 Jan 2026 04:02:20 +0000 (20:02 -0800)
This reverts commit d58b2498200724e4f8c12d71a5953da03c8c8bdf.

hugetlb_bootmem_alloc() is called only once, no need to check if it was
called already at its entry.

Other checks performed during HVO initialization are also no longer
necessary because sparse_init() that calls hugetlb_vmemmap_init_early()
and hugetlb_vmemmap_init_late() is always called after
hugetlb_bootmem_alloc().

Link: https://lkml.kernel.org/r/20260111082105.290734-30-rppt@kernel.org
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Acked-by: Muchun Song <muchun.song@linux.dev>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Alex Shi <alexs@kernel.org>
Cc: Andreas Larsson <andreas@gaisler.com>
Cc: "Borislav Petkov (AMD)" <bp@alien8.de>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: David Hildenbrand <david@kernel.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Dinh Nguyen <dinguyen@kernel.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Guo Ren <guoren@kernel.org>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Helge Deller <deller@gmx.de>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Klara Modin <klarasmodin@gmail.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Magnus Lindholm <linmag7@gmail.com>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Pratyush Yadav <pratyush@kernel.org>
Cc: Richard Weinberger <richard@nod.at>
Cc: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Stafford Horne <shorne@gmail.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Vineet Gupta <vgupta@kernel.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/hugetlb.h
mm/hugetlb.c
mm/hugetlb_vmemmap.c

index 00e6a73e7bba97d31686a8088fff32e5553bdf40..94a03591990c174e7683bcdb4261497c704a7577 100644 (file)
@@ -176,7 +176,6 @@ extern int sysctl_hugetlb_shm_group __read_mostly;
 extern struct list_head huge_boot_pages[MAX_NUMNODES];
 
 void hugetlb_bootmem_alloc(void);
-bool hugetlb_bootmem_allocated(void);
 extern nodemask_t hugetlb_bootmem_nodes;
 void hugetlb_bootmem_set_nodes(void);
 
@@ -1306,11 +1305,6 @@ static inline bool hugetlbfs_pagecache_present(
 static inline void hugetlb_bootmem_alloc(void)
 {
 }
-
-static inline bool hugetlb_bootmem_allocated(void)
-{
-       return false;
-}
 #endif /* CONFIG_HUGETLB_PAGE */
 
 static inline spinlock_t *huge_pte_lock(struct hstate *h,
index fe4b9f2ebdb62fe3d9873b62d348a3f6f168e4da..04385a0122de534c7b9efb9d88d1051b6a415272 100644 (file)
@@ -4486,21 +4486,11 @@ void __init hugetlb_bootmem_set_nodes(void)
        }
 }
 
-static bool __hugetlb_bootmem_allocated __initdata;
-
-bool __init hugetlb_bootmem_allocated(void)
-{
-       return __hugetlb_bootmem_allocated;
-}
-
 void __init hugetlb_bootmem_alloc(void)
 {
        struct hstate *h;
        int i;
 
-       if (__hugetlb_bootmem_allocated)
-               return;
-
        hugetlb_bootmem_set_nodes();
 
        for (i = 0; i < MAX_NUMNODES; i++)
@@ -4514,8 +4504,6 @@ void __init hugetlb_bootmem_alloc(void)
                if (hstate_is_gigantic(h))
                        hugetlb_hstate_alloc_pages(h);
        }
-
-       __hugetlb_bootmem_allocated = true;
 }
 
 /*
index 9d01f883fd71ec0a11a5e1b5af5ee35838152819..a9280259e12ad5141295cf7a8638614e07c938e4 100644 (file)
@@ -794,14 +794,6 @@ void __init hugetlb_vmemmap_init_early(int nid)
        struct huge_bootmem_page *m = NULL;
        void *map;
 
-       /*
-        * Noting to do if bootmem pages were not allocated
-        * early in boot, or if HVO wasn't enabled in the
-        * first place.
-        */
-       if (!hugetlb_bootmem_allocated())
-               return;
-
        if (!READ_ONCE(vmemmap_optimize_enabled))
                return;
 
@@ -847,9 +839,6 @@ void __init hugetlb_vmemmap_init_late(int nid)
        struct hstate *h;
        void *map;
 
-       if (!hugetlb_bootmem_allocated())
-               return;
-
        if (!READ_ONCE(vmemmap_optimize_enabled))
                return;