[PATCH v2 2/2] mm: hugetlb: fix the name of hugetlb CMA

From: Barry Song
Date: Tue Jun 16 2020 - 18:33:44 EST


once we enable CMA_DEBUGFS, we will get the below errors:
directory 'cma-hugetlb' with parent 'cma' already present

we should have different names for different CMA areas.

Acked-by: Roman Gushchin <guro@xxxxxx>
Reviewed-by: Mike Kravetz <mike.kravetz@xxxxxxxxxx>
Signed-off-by: Barry Song <song.bao.hua@xxxxxxxxxxxxx>
---
-v2:
rebase to 5.8-rc1
add acked-by and reviewed-by

mm/hugetlb.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 57ece74e3aae..d54bb7e35005 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -5692,12 +5692,14 @@ void __init hugetlb_cma_reserve(int order)
reserved = 0;
for_each_node_state(nid, N_ONLINE) {
int res;
+ char name[20];

size = min(per_node, hugetlb_cma_size - reserved);
size = round_up(size, PAGE_SIZE << order);

+ snprintf(name, 20, "hugetlb%d", nid);
res = cma_declare_contiguous_nid(0, size, 0, PAGE_SIZE << order,
- 0, false, "hugetlb",
+ 0, false, name,
&hugetlb_cma[nid], nid);
if (res) {
pr_warn("hugetlb_cma: reservation failed: err %d, node %d",
--
2.23.0