diff mbox series

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

Message ID 20200603084025.62740-3-song.bao.hua@hisilicon.com (mailing list archive)
State New, archived
Headers show
Series mm: fix the names of general cma and hugetlb cma | expand

Commit Message

Song Bao Hua (Barry Song) June 3, 2020, 8:40 a.m. UTC
once we enable CMA_DEBUGFS, we will get the below errors:
directory 'cma-hugetlb' with parent 'cma' already present

only the first numa node will get a directory in debugfs.
we should have different names for different CMA areas.

Cc: Roman Gushchin <guro@fb.com>
Signed-off-by: Barry Song <song.bao.hua@hisilicon.com>
---
 mm/hugetlb.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Roman Gushchin June 3, 2020, 2:13 p.m. UTC | #1
On Wed, Jun 03, 2020 at 08:40:25PM +1200, Barry Song wrote:
> once we enable CMA_DEBUGFS, we will get the below errors:
> directory 'cma-hugetlb' with parent 'cma' already present
> 
> only the first numa node will get a directory in debugfs.
> we should have different names for different CMA areas.
> 
> Cc: Roman Gushchin <guro@fb.com>
> Signed-off-by: Barry Song <song.bao.hua@hisilicon.com>

Acked-by: Roman Gushchin <guro@fb.com>

> ---
>  mm/hugetlb.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index bcabbe02192b..4ebc4edc3b40 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -5586,12 +5586,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
> 
> 
>
Mike Kravetz June 3, 2020, 5:28 p.m. UTC | #2
On 6/3/20 1:40 AM, Barry Song wrote:
> once we enable CMA_DEBUGFS, we will get the below errors:
> directory 'cma-hugetlb' with parent 'cma' already present
> 
> only the first numa node will get a directory in debugfs.
> we should have different names for different CMA areas.
> 
> Cc: Roman Gushchin <guro@fb.com>
> Signed-off-by: Barry Song <song.bao.hua@hisilicon.com>

Thank you

Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>

--
Mike Kravetz
diff mbox series

Patch

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index bcabbe02192b..4ebc4edc3b40 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -5586,12 +5586,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",