linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Longpeng(Mike)" <longpeng2@huawei.com>
To: <mike.kravetz@oracle.com>
Cc: <arei.gonglei@huawei.com>, <huangzhichao@huawei.com>,
	Longpeng <longpeng2@huawei.com>,
	Matthew Wilcox <willy@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>, Qian Cai <cai@lca.pw>,
	<linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>
Subject: [PATCH] mm/hugetlb: avoid weird message in hugetlb_init
Date: Thu, 5 Mar 2020 11:30:14 +0800	[thread overview]
Message-ID: <20200305033014.1152-1-longpeng2@huawei.com> (raw)

From: Longpeng <longpeng2@huawei.com>

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 <willy@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Qian Cai <cai@lca.pw>
Cc: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org
Signed-off-by: Longpeng <longpeng2@huawei.com>
---
 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) {
-- 
1.8.3.1


             reply	other threads:[~2020-03-05  3:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-05  3:30 Longpeng(Mike) [this message]
2020-03-06  0:09 ` [PATCH] mm/hugetlb: avoid weird message in hugetlb_init Mike Kravetz
2020-03-06  6:36   ` Longpeng (Mike)
2020-03-06 20:12     ` Mike Kravetz
2020-03-09  8:16       ` Longpeng (Mike)
2020-04-10 15:47       ` Nitesh Narayan Lal
2020-04-13 18:33         ` Mike Kravetz
2020-04-13 21:21           ` Nitesh Narayan Lal
2020-04-15  4:03             ` Mike Kravetz
2020-04-15 11:46               ` Nitesh Narayan Lal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200305033014.1152-1-longpeng2@huawei.com \
    --to=longpeng2@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=arei.gonglei@huawei.com \
    --cc=cai@lca.pw \
    --cc=huangzhichao@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mike.kravetz@oracle.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).