[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240209065036.1412670-1-anshuman.khandual@arm.com>
Date: Fri, 9 Feb 2024 12:20:36 +0530
From: Anshuman Khandual <anshuman.khandual@....com>
To: linux-mm@...ck.org
Cc: Anshuman Khandual <anshuman.khandual@....com>,
Muchun Song <muchun.song@...ux.dev>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org
Subject: [PATCH] mm/hugetlb: Ensure adequate CMA areas available for hugetlb_cma[]
HugeTLB CMA area array is being created for possible MAX_NUMNODES without
ensuring corresponding MAX_CMA_AREAS support in CMA. Let's just warn for
such scenarios indicating need for CONFIG_CMA_AREAS adjustment.
Cc: Muchun Song <muchun.song@...ux.dev>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-mm@...ck.org
Cc: linux-kernel@...r.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@....com>
---
This applies on v6.8-rc3
mm/hugetlb.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index a188b7c60f4f..fda8ced69832 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -7750,6 +7750,13 @@ void __init hugetlb_cma_reserve(int order)
}
reserved = 0;
+
+ /*
+ * There needs to be enough MAX_CMA_AREAS to accommodate
+ * MAX_NUMNODES heap areas being created here. Otherwise
+ * adjust CONFIG_CMA_AREAS as required.
+ */
+ VM_WARN_ON(MAX_CMA_AREAS < MAX_NUMNODES);
for_each_online_node(nid) {
int res;
char name[CMA_MAX_NAME];
--
2.25.1
Powered by blists - more mailing lists