mm/hugetlb: remove HUGE_BOOTMEM_CMA

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.

Link: https://lore.kernel.org/20260910063256.64386-16-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:54 +08:00 committed by Andrew Morton
parent 4d012c702c
commit eedb6c3835
2 changed files with 4 additions and 11 deletions

View File

@ -676,7 +676,6 @@ struct hstate {
};
#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

@ -3133,7 +3133,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) &&
@ -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_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)
@ -3305,9 +3300,6 @@ static void __init gather_bootmem_prealloc_node(unsigned long nid)
folio_set_hugetlb_vmemmap_optimized(folio);
section_set_compound_order_range(pfn, folio_nr_pages(folio), 0);
if (hugetlb_bootmem_page_earlycma(m))
folio_set_hugetlb_cma(folio);
list_add(&folio->lru, &folio_list);
/*
@ -3318,7 +3310,9 @@ static void __init gather_bootmem_prealloc_node(unsigned long nid)
* For CMA pages, this is done in init_cma_pageblock
* (via hugetlb_bootmem_init_migratetype), so skip it here.
*/
if (!folio_test_hugetlb_cma(folio))
if (hugetlb_early_cma(h))
folio_set_hugetlb_cma(folio);
else
adjust_managed_page_count(page, pages_per_huge_page(h));
cond_resched();
}