Track early CMA hugetlb pages from the hstate instead of storing a redundant bootmem flag. This removes the unused helper and keeps the bootmem metadata minimal.
Signed-off-by: Muchun Song <[email protected]> --- include/linux/hugetlb.h | 1 - mm/hugetlb.c | 9 ++------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 18af8f304b95..82dbb9ebead8 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -696,7 +696,6 @@ struct huge_bootmem_page { }; #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); diff --git a/mm/hugetlb.c b/mm/hugetlb.c index abd79bb85b1c..74770c1648fc 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -3093,7 +3093,7 @@ static bool __init alloc_bootmem_huge_page(struct hstate *h, int nid) */ INIT_LIST_HEAD(&m->list); m->hstate = h; - m->flags = hugetlb_early_cma(h) ? HUGE_BOOTMEM_CMA : 0; + m->flags = 0; /* CMA pages: zone-crossing is validated in hugetlb_cma_reserve(). */ if (!hugetlb_early_cma(h) && @@ -3169,11 +3169,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_earlycma(struct huge_bootmem_page *m) -{ - return m->flags & HUGE_BOOTMEM_CMA; -} - /* * memblock-allocated pageblocks might not have the migrate type set * if marked with the 'noinit' flag. Set it to the default (MIGRATE_MOVABLE) @@ -3265,7 +3260,7 @@ static void __init gather_bootmem_prealloc_node(unsigned long nid) section_set_order_range(folio_pfn(folio), folio_nr_pages(folio), 0); } - if (hugetlb_bootmem_page_earlycma(m)) + if (hugetlb_early_cma(h)) folio_set_hugetlb_cma(folio); list_add(&folio->lru, &folio_list); -- 2.54.0
