From patchwork Thu Mar 5 03:30:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Longpeng(Mike)" X-Patchwork-Id: 11421129 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 25B2214B4 for ; Thu, 5 Mar 2020 03:30:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DC947208CD for ; Thu, 5 Mar 2020 03:30:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DC947208CD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0DD586B0003; Wed, 4 Mar 2020 22:30:41 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 068476B0005; Wed, 4 Mar 2020 22:30:41 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E98C46B0007; Wed, 4 Mar 2020 22:30:40 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0182.hostedemail.com [216.40.44.182]) by kanga.kvack.org (Postfix) with ESMTP id CEB476B0003 for ; Wed, 4 Mar 2020 22:30:40 -0500 (EST) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 67CB0180AD801 for ; Thu, 5 Mar 2020 03:30:40 +0000 (UTC) X-FDA: 76559881440.01.pigs56_5cb05b865a5b X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,longpeng2@huawei.com,,RULES_HIT:30054:30056,0,RBL:45.249.212.190:@huawei.com:.lbl8.mailshell.net-62.18.2.100 64.95.201.95,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: pigs56_5cb05b865a5b X-Filterd-Recvd-Size: 2762 Received: from huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf11.hostedemail.com (Postfix) with ESMTP for ; Thu, 5 Mar 2020 03:30:39 +0000 (UTC) Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 69B3F320F9A24C1D3991; Thu, 5 Mar 2020 11:30:36 +0800 (CST) Received: from DESKTOP-27KDQMV.china.huawei.com (10.173.228.124) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.439.0; Thu, 5 Mar 2020 11:30:26 +0800 From: "Longpeng(Mike)" To: CC: , , Longpeng , Matthew Wilcox , Andrew Morton , Qian Cai , , Subject: [PATCH] mm/hugetlb: avoid weird message in hugetlb_init Date: Thu, 5 Mar 2020 11:30:14 +0800 Message-ID: <20200305033014.1152-1-longpeng2@huawei.com> X-Mailer: git-send-email 2.25.0.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.173.228.124] X-CFilter-Loop: Reflected 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: From: Longpeng Some architectures(e.g. x86,risv) doesn't add 2M-hstate by default, so if we add 'default_hugepagesz=2M' but without 'hugepagesz=2M' in cmdline, we'll get a message as follow: "HugeTLB: unsupported default_hugepagesz 2097152. Reverting to 2097152" As architecture-specific HPAGE_SIZE hstate should be supported by default, we can avoid this weird message by add it if we hadn't yet. Cc: Matthew Wilcox Cc: Andrew Morton Cc: Qian Cai Cc: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org Signed-off-by: Longpeng --- mm/hugetlb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index dd8737a..21f623b 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2829,6 +2829,9 @@ static int __init hugetlb_init(void) if (!hugepages_supported()) return 0; + if (!size_to_hstate(HPAGE_SIZE)) + hugetlb_add_hstate(HUGETLB_PAGE_ORDER); + if (!size_to_hstate(default_hstate_size)) { if (default_hstate_size != 0) { pr_err("HugeTLB: unsupported default_hugepagesz %lu. Reverting to %lu\n", @@ -2836,8 +2839,6 @@ static int __init hugetlb_init(void) } default_hstate_size = HPAGE_SIZE; - if (!size_to_hstate(default_hstate_size)) - hugetlb_add_hstate(HUGETLB_PAGE_ORDER); } default_hstate_idx = hstate_index(size_to_hstate(default_hstate_size)); if (default_hstate_max_huge_pages) {