lkml.org 
[lkml]   [2020]   [Mar]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] mm/hugetlb: avoid weird message in hugetlb_init
Date
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
\
 
 \ /
  Last update: 2020-03-05 04:31    [W:0.110 / U:2.336 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site