[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHS8izOeYeVi-W7z-DKw3Uv0rAqwuD1__uTr-oF6Lx=V9ekm3g@mail.gmail.com>
Date: Mon, 23 Mar 2020 16:56:43 -0700
From: Mina Almasry <almasrymina@...gle.com>
To: Christophe Leroy <christophe.leroy@....fr>
Cc: Mike Kravetz <mike.kravetz@...cle.com>,
Linux-MM <linux-mm@...ck.org>,
open list <linux-kernel@...r.kernel.org>,
linux-arm-kernel@...ts.infradead.org,
linuxppc-dev@...ts.ozlabs.org, linux-riscv@...ts.infradead.org,
linux-s390@...r.kernel.org, sparclinux@...r.kernel.org,
linux-doc@...r.kernel.org, Albert Ou <aou@...s.berkeley.edu>,
Andrew Morton <akpm@...ux-foundation.org>,
Vasily Gorbik <gor@...ux.ibm.com>,
Jonathan Corbet <corbet@....net>,
Catalin Marinas <catalin.marinas@....com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Heiko Carstens <heiko.carstens@...ibm.com>,
Christian Borntraeger <borntraeger@...ibm.com>,
Ingo Molnar <mingo@...hat.com>,
Palmer Dabbelt <palmer@...belt.com>,
Paul Walmsley <paul.walmsley@...ive.com>,
Paul Mackerras <paulus@...ba.org>,
Thomas Gleixner <tglx@...utronix.de>,
Longpeng <longpeng2@...wei.com>, Will Deacon <will@...nel.org>,
"David S . Miller" <davem@...emloft.net>
Subject: Re: [PATCH 2/4] hugetlbfs: move hugepagesz= parsing to arch
independent code
On Thu, Mar 19, 2020 at 12:04 AM Christophe Leroy
<christophe.leroy@....fr> wrote:
>
>
>
> Le 18/03/2020 à 23:06, Mike Kravetz a écrit :
> > Now that architectures provide arch_hugetlb_valid_size(), parsing
> > of "hugepagesz=" can be done in architecture independent code.
> > Create a single routine to handle hugepagesz= parsing and remove
> > all arch specific routines. We can also remove the interface
> > hugetlb_bad_size() as this is no longer used outside arch independent
> > code.
> >
> > This also provides consistent behavior of hugetlbfs command line
> > options. The hugepagesz= option should only be specified once for
> > a specific size, but some architectures allow multiple instances.
> > This appears to be more of an oversight when code was added by some
> > architectures to set up ALL huge pages sizes.
> >
> > Signed-off-by: Mike Kravetz <mike.kravetz@...cle.com>
> > ---
> > arch/arm64/mm/hugetlbpage.c | 15 ---------------
> > arch/powerpc/mm/hugetlbpage.c | 15 ---------------
> > arch/riscv/mm/hugetlbpage.c | 16 ----------------
> > arch/s390/mm/hugetlbpage.c | 18 ------------------
> > arch/sparc/mm/init_64.c | 22 ----------------------
> > arch/x86/mm/hugetlbpage.c | 16 ----------------
> > include/linux/hugetlb.h | 1 -
> > mm/hugetlb.c | 24 ++++++++++++++++++------
> > 8 files changed, 18 insertions(+), 109 deletions(-)
> >
>
> [snip]
>
> > diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> > index 2f99359b93af..cd4ec07080fb 100644
> > --- a/mm/hugetlb.c
> > +++ b/mm/hugetlb.c
> > @@ -3149,12 +3149,6 @@ static int __init hugetlb_init(void)
> > }
> > subsys_initcall(hugetlb_init);
> >
> > -/* Should be called on processing a hugepagesz=... option */
> > -void __init hugetlb_bad_size(void)
> > -{
> > - parsed_valid_hugepagesz = false;
> > -}
> > -
> > void __init hugetlb_add_hstate(unsigned int order)
> > {
> > struct hstate *h;
> > @@ -3224,6 +3218,24 @@ static int __init hugetlb_nrpages_setup(char *s)
> > }
> > __setup("hugepages=", hugetlb_nrpages_setup);
> >
> > +static int __init hugepagesz_setup(char *s)
> > +{
> > + unsigned long long size;
> > + char *saved_s = s;
> > +
> > + size = memparse(s, &s);
>
> You don't use s after that, so you can pass NULL instead of &s and avoid
> the saved_s
>
+1
Acked-by: Mina Almasry <almasrymina@...gle.com>
Powered by blists - more mailing lists