[PATCH v2 0/9] mm: hugetlb: cleanup and allocate frozen hugetlb folio

Kefeng Wang
2025-09-02T12:49:19Z

The first part is to cleanup some hugetlb folio allocation and the
others convert to allocate frozen folio in gigantic folio, similar
to alloc_buddy_hugetlb_folio(), avoid atomic operation about folio
refcount.

v2:
- Add RB and address some comments(per Vishal / Jane)
- Naming is hard, so don't add hvo for alloc_fresh_hugetlb_folio()
and only drop __prep prfix for account new hugetlb folio
- Add ACR_FLAGS_FROZEN for allocating frozen compound pages
- Refactoring the cma alloc/release to prepare for cma alloc/free
frozen folio

v1:
- https://lore.kernel.org/linux-mm/20250802073107.2787975-1-wangkefeng.wang@huawei.com/

Kefeng Wang (9):
mm: hugetlb: convert to use more alloc_fresh_hugetlb_folio()
mm: hugetlb: convert to account_new_hugetlb_folio()
mm: hugetlb: directly pass order when allocate a hugetlb folio
mm: hugetlb: remove struct hstate from init_new_hugetlb_folio()
mm: hugeltb: check NUMA_NO_NODE in only_alloc_fresh_hugetlb_folio()
mm: page_alloc: add alloc_contig_frozen_pages()
mm: cma: add alloc flags for __cma_alloc()
mm: cma: add __cma_release()
mm: hugetlb: allocate frozen pages in alloc_gigantic_folio()

include/linux/cma.h | 9 ++-
include/linux/gfp.h | 20 +++---
mm/cma.c | 84 +++++++++++---------------
mm/hugetlb.c | 144 +++++++++++++++-----------------------------
mm/hugetlb_cma.c | 14 ++---
mm/hugetlb_cma.h | 10 +--
mm/page_alloc.c | 85 ++++++++++++++------------
7 files changed, 157 insertions(+), 209 deletions(-)

--
2.27.0