Re: [PATCH v3] mm: hugetlb: optionally allocate gigantic hugepages using cma

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 12, 2020 at 09:33:20AM -0400, Qian Cai wrote:
> On Wed, 2020-03-11 at 15:09 -0700, Roman Gushchin wrote:
> > +#ifdef CONFIG_CMA
> > +static unsigned long hugetlb_cma_size __initdata;
> > +
> > +static int __init cmdline_parse_hugetlb_cma(char *p)
> > +{
> > +	unsigned long long val;
> > +	char *endptr;
> > +
> > +	if (!p)
> > +		return -EINVAL;
> > +
> > +	val = simple_strtoull(p, &endptr, 0);
> > +	hugetlb_cma_size = memparse(p, &p);
> > +	return 0;
> > +}
> > +
> 
> Here will generate a compilation warning,
> 
> mm/hugetlb.c: In function 'cmdline_parse_hugetlb_cma':
> mm/hugetlb.c:5548:21: warning: variable 'val' set but not used [-Wunused-but-
> set-variable]
>   unsigned long long val;
>                      ^~~
> Also, the comments for simple_strtoull() in lib/vsprintf.c said,
> 
> "This function is obsolete. Please use kstrtoull instead."
> 

Hello Qian!

Thank you, you're absolutely right.
The following patch should solve both problems:

--

>From d45741afdb9a760e48915c2d19e750f53019e19c Mon Sep 17 00:00:00 2001
From: Roman Gushchin <guro@xxxxxx>
Date: Thu, 12 Mar 2020 17:40:04 -0700
Subject: [PATCH] mm: cleanup cmdline_parse_hugetlb_cma()

Remove unused code.

Signed-off-by: Roman Gushchin <guro@xxxxxx>
---
 mm/hugetlb.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 66bfc2bdc203..7a20cae7c77a 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -5409,13 +5409,6 @@ static unsigned long hugetlb_cma_size __initdata;
 
 static int __init cmdline_parse_hugetlb_cma(char *p)
 {
-       unsigned long long val;
-       char *endptr;
-
-       if (!p)
-               return -EINVAL;
-
-       val = simple_strtoull(p, &endptr, 0);
        hugetlb_cma_size = memparse(p, &p);
        return 0;
 }
-- 
2.24.1






[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux