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

From: Roman Gushchin
Date: Thu Mar 12 2020 - 20:55:24 EST


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:

--