From: Roman Gushchin <guro@fb.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Michal Hocko" <mhocko@kernel.org>,
linux-mm@kvack.org, kernel-team@fb.com,
linux-kernel@vger.kernel.org, "Rik van Riel" <riel@surriel.com>,
"Andreas Schaufler" <andreas.schaufler@gmx.de>,
"Mike Kravetz" <mike.kravetz@oracle.com>,
"Guido Günther" <agx@sigxcpu.org>,
"Naresh Kamboju" <naresh.kamboju@linaro.org>,
"Roman Gushchin" <guro@fb.com>
Subject: [PATCH] mm: hugetlb: fix hugetlb_cma_reserve() if CONFIG_NUMA isn't set
Date: Wed, 18 Mar 2020 08:34:24 -0700 [thread overview]
Message-ID: <20200318153424.3202304-1-guro@fb.com> (raw)
If CONFIG_NUMA isn't set, there is no need to ensure that
the hugetlb cma area belongs to a specific numa node.
min/max_low_pfn can be used for limiting the maximum size
of the hugetlb_cma area.
Also for_each_mem_pfn_range() is defined only if
CONFIG_HAVE_MEMBLOCK_NODE_MAP is set, and on arm (unlike most
other architectures) it depends on CONFIG_NUMA. This makes the
build fail if CONFIG_NUMA isn't set.
Signed-off-by: Roman Gushchin <guro@fb.com>
Reported-by: Andreas Schaufler <andreas.schaufler@gmx.de>
---
mm/hugetlb.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 7a20cae7c77a..a6161239abde 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -5439,16 +5439,21 @@ void __init hugetlb_cma_reserve(int order)
reserved = 0;
for_each_node_state(nid, N_ONLINE) {
- unsigned long start_pfn, end_pfn;
unsigned long min_pfn = 0, max_pfn = 0;
- int res, i;
+ int res;
+#ifdef CONFIG_NUMA
+ unsigned long start_pfn, end_pfn;
+ int i;
for_each_mem_pfn_range(i, nid, &start_pfn, &end_pfn, NULL) {
if (!min_pfn)
min_pfn = start_pfn;
max_pfn = end_pfn;
}
-
+#else
+ min_pfn = min_low_pfn;
+ max_pfn = max_low_pfn;
+#endif
size = max(per_node, hugetlb_cma_size - reserved);
size = round_up(size, PAGE_SIZE << order);
--
2.24.1
next reply other threads:[~2020-03-18 15:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-18 15:34 Roman Gushchin [this message]
2020-03-18 16:16 ` Michal Hocko
2020-03-18 17:55 ` Roman Gushchin
2020-03-19 16:16 ` Michal Hocko
2020-03-19 16:56 ` Rik van Riel
2020-03-19 17:01 ` Michal Hocko
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=20200318153424.3202304-1-guro@fb.com \
--to=guro@fb.com \
--cc=agx@sigxcpu.org \
--cc=akpm@linux-foundation.org \
--cc=andreas.schaufler@gmx.de \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=mike.kravetz@oracle.com \
--cc=naresh.kamboju@linaro.org \
--cc=riel@surriel.com \
/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