[PATCH v3 04/28] mm, hugetlb: use cma_declare_contiguous_multi

From: Frank van der Linden
Date: Thu Feb 06 2025 - 13:52:01 EST


hugetlb_cma is fine with using multiple CMA ranges, as long as it
can get its gigantic pages allocated from them. So, use
cma_declare_contiguous_multi to allow for multiple ranges,
increasing the chances of getting what we want on systems
with gaps in physical memory.

Signed-off-by: Frank van der Linden <fvdl@xxxxxxxxxx>
---
mm/hugetlb.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 65068671e460..828ae0080ab5 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -7738,9 +7738,8 @@ void __init hugetlb_cma_reserve(int order)
* may be returned to CMA allocator in the case of
* huge page demotion.
*/
- res = cma_declare_contiguous_nid(0, size, 0,
- PAGE_SIZE << order,
- HUGETLB_PAGE_ORDER, false, name,
+ res = cma_declare_contiguous_multi(size, PAGE_SIZE << order,
+ HUGETLB_PAGE_ORDER, name,
&hugetlb_cma[nid], nid);
if (res) {
pr_warn("hugetlb_cma: reservation failed: err %d, node %d",
--
2.48.1.502.g6dc24dfdaf-goog