linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/hugetlb: avoid weird message in hugetlb_init
@ 2020-03-05  3:30 Longpeng(Mike)
  2020-03-06  0:09 ` Mike Kravetz
  0 siblings, 1 reply; 10+ messages in thread
From: Longpeng(Mike) @ 2020-03-05  3:30 UTC (permalink / raw)
  To: mike.kravetz
  Cc: arei.gonglei, huangzhichao, Longpeng, Matthew Wilcox,
	Andrew Morton, Qian Cai, linux-kernel, linux-mm

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



^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-04-15 11:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-05  3:30 [PATCH] mm/hugetlb: avoid weird message in hugetlb_init Longpeng(Mike)
2020-03-06  0:09 ` 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

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).