From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9694C4332B for ; Mon, 23 Mar 2020 23:56:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8EDF72070A for ; Mon, 23 Mar 2020 23:56:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="cxRClrga" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8EDF72070A Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 25CAE6B0007; Mon, 23 Mar 2020 19:56:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 20E226B0008; Mon, 23 Mar 2020 19:56:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0D48B6B000A; Mon, 23 Mar 2020 19:56:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0122.hostedemail.com [216.40.44.122]) by kanga.kvack.org (Postfix) with ESMTP id E86F86B0007 for ; Mon, 23 Mar 2020 19:56:55 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id C13A518690865 for ; Mon, 23 Mar 2020 23:56:55 +0000 (UTC) X-FDA: 76628289990.17.force62_76ae11e336e09 X-HE-Tag: force62_76ae11e336e09 X-Filterd-Recvd-Size: 6159 Received: from mail-ot1-f65.google.com (mail-ot1-f65.google.com [209.85.210.65]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Mon, 23 Mar 2020 23:56:55 +0000 (UTC) Received: by mail-ot1-f65.google.com with SMTP id 111so15342505oth.13 for ; Mon, 23 Mar 2020 16:56:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=Ix8wgcI17GVIT6csUF0tAYBE2LaGOYJ65o4zi4Z+Z6c=; b=cxRClrgaWN/fpDic28j6dquzcmGVw+xYCBcb9evltHJpyFpceHUzfKZJMIJhOLclFx Yn2A3TP5Stbe0rKKKA/IDNeP6sQu7YUUq74s5fXrAmxwnECa9lFLzGP2bXzZ2DmVKPgL UDLguXXmIlABThiCSt5lssfGYmuDsDVHy3ovX3K/B0/plnPrQcOqebITxOQuZ/DZffwT OhGqRBkkNp3UqEPletWR4FAIHWjJFvKqYVN8qCAzkXSZ9bQ7aH/jjGGf8ucrXstsZArj gA7y7Jxp7obe4aoMrhUye9oj3Q9UqQfJGy1EH69U31823NIqpoSP5pj6ibFOe6U4weCd K+uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Ix8wgcI17GVIT6csUF0tAYBE2LaGOYJ65o4zi4Z+Z6c=; b=gEgr/knk98F4BP83iqQ4DPGL4EYsNTvzTUxdHc/l308JZKpyiQYHhSk8lmxSibs3IH s8VAYUZW4AU1cbIY3NcycIJPGsxDjHKP0i/YyjwOvI5cf/qMsMpkgFHOIFR0FcO+D8T1 lOiSUczyUG/t+2pRlhCC9cAC1Op2h3ZslXn59SoQpidNDcksDvF58pfp4Sz/beEHYCwx x9CxUVZYaBdVgfGJH0cPFupamuy28zvSoWVMPWhy+XWOJ5hE9y2o1rwszBiyrW0szhG8 FCV2BmS7QMvJF6B1VmYa2/RYzj3vfid9rg+EpuJvC0BizLjie7BGbgXI0twZlBsH8feM Xpzw== X-Gm-Message-State: ANhLgQ0cXRCDHCxMjghcHaVEs4nSkxb6LOCc+96zrF33gdhgC/lDOQJT gBFDEf08toFUwR5OfnQEM5/hh7cdbUCBt7+a0xoMsA== X-Google-Smtp-Source: ADFU+vuDPdpSQy4eIZVOQE+DA/YA6x9KuEZDOGaV/GyUNXkAFHrjBMzNKJjNEWfmfUZNmYn+XKHPMpfaDEYyQ1QtrIo= X-Received: by 2002:a05:6830:1e10:: with SMTP id s16mr4024265otr.33.1585007814217; Mon, 23 Mar 2020 16:56:54 -0700 (PDT) MIME-Version: 1.0 References: <20200318220634.32100-1-mike.kravetz@oracle.com> <20200318220634.32100-3-mike.kravetz@oracle.com> <2ca058dc-47e6-1d08-154b-77d2cbe98e34@c-s.fr> In-Reply-To: <2ca058dc-47e6-1d08-154b-77d2cbe98e34@c-s.fr> From: Mina Almasry Date: Mon, 23 Mar 2020 16:56:43 -0700 Message-ID: Subject: Re: [PATCH 2/4] hugetlbfs: move hugepagesz= parsing to arch independent code To: Christophe Leroy Cc: Mike Kravetz , Linux-MM , open list , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, linux-doc@vger.kernel.org, Albert Ou , Andrew Morton , Vasily Gorbik , Jonathan Corbet , Catalin Marinas , Dave Hansen , Heiko Carstens , Christian Borntraeger , Ingo Molnar , Palmer Dabbelt , Paul Walmsley , Paul Mackerras , Thomas Gleixner , Longpeng , Will Deacon , "David S . Miller" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Mar 19, 2020 at 12:04 AM Christophe Leroy wrote: > > > > Le 18/03/2020 =C3=A0 23:06, Mike Kravetz a =C3=A9crit : > > Now that architectures provide arch_hugetlb_valid_size(), parsing > > of "hugepagesz=3D" can be done in architecture independent code. > > Create a single routine to handle hugepagesz=3D 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=3D 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 > > --- > > 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=3D... option */ > > -void __init hugetlb_bad_size(void) > > -{ > > - parsed_valid_hugepagesz =3D 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=3D", hugetlb_nrpages_setup); > > > > +static int __init hugepagesz_setup(char *s) > > +{ > > + unsigned long long size; > > + char *saved_s =3D s; > > + > > + size =3D 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