lkml.org 
[lkml]   [2020]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH v3] mm: hugetlb: optionally allocate gigantic hugepages using cma
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@fb.com>
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@fb.com>
---
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
\
 
 \ /
  Last update: 2020-03-13 01:55    [W:0.104 / U:0.432 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site