mm/hugetlb: remove HUGE_BOOTMEM_HVO

The HUGE_BOOTMEM_HVO flag tracked whether a bootmem huge page had already
gone through the old early vmemmap optimization path.

Now that HugeTLB uses section-based vmemmap optimization, that state is
already reflected in the compound page order stored in section metadata.

Remove HUGE_BOOTMEM_HVO and its helper, and use the section state directly
when deciding whether to mark a folio as vmemmap-optimized.

Link: https://lore.kernel.org/20260910063256.64386-15-songmuchun@bytedance.com
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Acked-by: Qi Zheng <qi.zheng@linux.dev>
Cc: David Hildenbrand (Arm) <david@kernel.org>
Cc: David Laight <david.laight.linux@gmail.com>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
This commit is contained in:
Muchun Song 2026-09-10 14:32:53 +08:00 committed by Andrew Morton
parent 7d55d0a118
commit 4d012c702c
3 changed files with 5 additions and 18 deletions

View File

@ -675,9 +675,8 @@ struct hstate {
char name[HSTATE_NAME_LEN];
};
#define HUGE_BOOTMEM_HVO 0x0001
#define HUGE_BOOTMEM_ZONES_VALID 0x0002
#define HUGE_BOOTMEM_CMA 0x0004
#define HUGE_BOOTMEM_ZONES_VALID BIT(0)
#define HUGE_BOOTMEM_CMA BIT(1)
int isolate_or_dissolve_huge_folio(struct folio *folio, struct list_head *list);
int replace_free_hugepage_folios(unsigned long start_pfn, unsigned long end_pfn);

View File

@ -3209,11 +3209,6 @@ static void __init hugetlb_folio_init_vmemmap(struct folio *folio,
prep_compound_head(&folio->page, huge_page_order(h));
}
static bool __init hugetlb_bootmem_page_prehvo(struct huge_bootmem_page *m)
{
return m->flags & HUGE_BOOTMEM_HVO;
}
static bool __init hugetlb_bootmem_page_earlycma(struct huge_bootmem_page *m)
{
return m->flags & HUGE_BOOTMEM_CMA;
@ -3288,6 +3283,7 @@ static void __init gather_bootmem_prealloc_node(unsigned long nid)
list_for_each_entry_safe(m, tm, &huge_boot_pages[nid], list) {
struct page *page = virt_to_page(m);
struct folio *folio = (void *)page;
const unsigned long pfn = folio_pfn(folio);
h = m->hstate;
/*
@ -3305,15 +3301,9 @@ static void __init gather_bootmem_prealloc_node(unsigned long nid)
HUGETLB_VMEMMAP_RESERVE_PAGES);
init_new_hugetlb_folio(folio);
if (hugetlb_bootmem_page_prehvo(m))
/*
* If pre-HVO was done, just set the
* flag, the HVO code will then skip
* this folio.
*/
if (vmemmap_optimizable_order(pfn_to_section_compound_order(pfn)))
folio_set_hugetlb_vmemmap_optimized(folio);
section_set_compound_order_range(folio_pfn(folio),
folio_nr_pages(folio), 0);
section_set_compound_order_range(pfn, folio_nr_pages(folio), 0);
if (hugetlb_bootmem_page_earlycma(m))
folio_set_hugetlb_cma(folio);

View File

@ -715,8 +715,6 @@ void __init hugetlb_vmemmap_optimize_bootmem_page(struct huge_bootmem_page *m)
section_set_compound_order_range(pfn, pages_per_huge_page(h),
huge_page_order(h));
if (vmemmap_optimizable_order(pfn_to_section_compound_order(pfn)))
m->flags |= HUGE_BOOTMEM_HVO;
}
static const struct ctl_table hugetlb_vmemmap_sysctls[] = {