Received: by 2002:a25:d783:0:0:0:0:0 with SMTP id o125csp328236ybg; Thu, 19 Mar 2020 00:05:15 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsEhqRbXH3sOf8nc04onOFh3Rwx0BU1z4QxCLf6sfKtl29M6DysqQANmeOaUX7iy54dicQW X-Received: by 2002:a9d:518e:: with SMTP id y14mr1080462otg.27.1584601515511; Thu, 19 Mar 2020 00:05:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584601515; cv=none; d=google.com; s=arc-20160816; b=Mglf/WtZ+G3YVAoFcGWeu9tPamD7zxbqWFUwx9kRkjabZN3qJhVvvr+L2SGUU4UrxW 5K4MPSes7xzaoHvT/ABX9Mthc0nFO1OdtR2WfatejYYlZsmTeR1mXz5frh/ef2kV+gKc Tr9/9VEPgh6grim45G0Um6kAo6BcNV07pj/8QxNIl31bH6R7Sx5gTzTZf8/uYhgIZ4GE DOfjrVKiRrGgjtdaTrHr7P9SdXayaVTdLdqgcgPv4RSprl/1FPsndt00c555xpWDUEP+ UypqrzRDanab7xi1amqvfOsbILr9kmpnd/00Ehzytxuzo+6Fe+pYlGWMqZN0Ao4UljFe CE4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=5ZZ9JpRLP71PK+VNpemb+Gegi8ltDnpAruGHqikdnkM=; b=hjkqZ+cjWLpI5vdWxUVh8J8LNA83bSAgtT5gFpJCOLhyiP2W+2mVtj7PzSoBbe1kn8 Jd1hvmGHzYhB5WeoCqRgm2PMf1/7o2OROi+wONgUwlMUllTFPe4M7T4JlwvGHcjwwmxw qXSt6NtyD5UBOcJXU+qp3GYcePeaZtmZz9LW3N4jr+xIyv7cJpmAN4XX9MDZY4GpzRGn wi7n7IQ+N1bgfVeRjyLoDOnQvfdl773FpT36SVWQdruSc+uPtO8Exhb2UxOoh4QXWMeH E0upmwpLXZUAMG3x1ih1iwQUxzpdhxKh5hQu1N16eU4WCEe7fR0o3JpvvkYHRqeCsSBR kxsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=miVDWU3+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b9si1023484ots.148.2020.03.19.00.04.52; Thu, 19 Mar 2020 00:05:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=miVDWU3+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727101AbgCSHEc (ORCPT + 99 others); Thu, 19 Mar 2020 03:04:32 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:14423 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725787AbgCSHEc (ORCPT ); Thu, 19 Mar 2020 03:04:32 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 48jdF71sjtz9v1Md; Thu, 19 Mar 2020 08:04:27 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=miVDWU3+; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id LNpYefN951gJ; Thu, 19 Mar 2020 08:04:27 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 48jdF70XNZz9v1Mc; Thu, 19 Mar 2020 08:04:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1584601467; bh=5ZZ9JpRLP71PK+VNpemb+Gegi8ltDnpAruGHqikdnkM=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=miVDWU3+a2y0u275N9hD/wlPdJIb1qmEFxnWhWbDAcuzzhQKA62bOJRlcQS+0FgpJ 1oDaIjZur3d9lpK8mGIRkzkhqA4W3uvhQ9x7BDYfoczEr1ShtNesHCpCKh7CmjNR3c w9QIjLFWO20jXxv/VZmy7eFG3M/ZUt7wHjFbPowk= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id E903D8B772; Thu, 19 Mar 2020 08:04:27 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id NWMcTA98PEcE; Thu, 19 Mar 2020 08:04:27 +0100 (CET) Received: from [192.168.4.90] (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 8F89E8B769; Thu, 19 Mar 2020 08:04:26 +0100 (CET) Subject: Re: [PATCH 2/4] hugetlbfs: move hugepagesz= parsing to arch independent code To: Mike Kravetz , linux-mm@kvack.org, linux-kernel@vger.kernel.org, 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 Cc: 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" References: <20200318220634.32100-1-mike.kravetz@oracle.com> <20200318220634.32100-3-mike.kravetz@oracle.com> From: Christophe Leroy Message-ID: <2ca058dc-47e6-1d08-154b-77d2cbe98e34@c-s.fr> Date: Thu, 19 Mar 2020 08:04:21 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20200318220634.32100-3-mike.kravetz@oracle.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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 > + > + if (!arch_hugetlb_valid_size(size)) { > + parsed_valid_hugepagesz = false; > + pr_err("HugeTLB: unsupported hugepagesz %s\n", saved_s); > + return 0; > + } > + > + hugetlb_add_hstate(ilog2(size) - PAGE_SHIFT); > + return 1; > +} > +__setup("hugepagesz=", hugepagesz_setup); > + > static int __init default_hugepagesz_setup(char *s) > { > unsigned long long size; > Christophe