From: Mike Kravetz <mike.kravetz@oracle.com>
To: "Song Bao Hua (Barry Song)" <song.bao.hua@hisilicon.com>,
Roman Gushchin <guro@fb.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Linuxarm <linuxarm@huawei.com>,
Jonathan Cameron <jonathan.cameron@huawei.com>
Subject: Re: [PATCH v3] mm/hugetlb: avoid hardcoding while checking if cma is enable
Date: Thu, 9 Jul 2020 11:58:11 -0700 [thread overview]
Message-ID: <b2a98ab7-0a36-ad3d-f40d-1cc9216c7961@oracle.com> (raw)
In-Reply-To: <B926444035E5E2439431908E3842AFD2560E41@DGGEMI525-MBS.china.huawei.com>
Looks like this produced a warning in linux-next. I suspect it is due to the
combination CONFIG_HUGETLB_PAGE && !CONFIG_CMA.
Instead of adding the routine hugetlb_cma_enabled() to scan the hugetlb_cma
array, could we just use a boolean as follows? It can simply be set in
hugetlb_cma_reserve when we reserve CMA.
--
Mike Kravetz
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index fab4485b9e52..92cb882cf287 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -46,6 +46,7 @@ unsigned int default_hstate_idx;
struct hstate hstates[HUGE_MAX_HSTATE];
static struct cma *hugetlb_cma[MAX_NUMNODES];
+static bool hugetlb_cma_enabled = false;
/*
* Minimum page order among possible hugepage sizes, set to a proper value
@@ -2571,7 +2572,7 @@ static void __init hugetlb_hstate_alloc_pages(struct hstate *h)
for (i = 0; i < h->max_huge_pages; ++i) {
if (hstate_is_gigantic(h)) {
- if (IS_ENABLED(CONFIG_CMA) && hugetlb_cma[0]) {
+ if (hugetlb_cma_enabled) {
pr_warn_once("HugeTLB: hugetlb_cma is enabled, skip boot time allocation\n");
break;
}
@@ -5708,6 +5709,7 @@ void __init hugetlb_cma_reserve(int order)
reserved += size;
pr_info("hugetlb_cma: reserved %lu MiB on node %d\n",
size / SZ_1M, nid);
+ hugetlb_cma_enabled = true;
if (reserved >= hugetlb_cma_size)
break;
next prev parent reply other threads:[~2020-07-09 18:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-07 4:02 [PATCH v3] mm/hugetlb: avoid hardcoding while checking if cma is enable Barry Song
2020-07-07 8:18 ` Mike Rapoport
2020-07-07 19:56 ` Andrew Morton
2020-07-08 17:45 ` Mike Kravetz
2020-07-08 18:46 ` Roman Gushchin
2020-07-08 22:11 ` Song Bao Hua (Barry Song)
2020-07-09 18:58 ` Mike Kravetz [this message]
2020-07-09 23:45 ` Song Bao Hua (Barry Song)
2020-07-10 0:24 ` Mike Kravetz
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=b2a98ab7-0a36-ad3d-f40d-1cc9216c7961@oracle.com \
--to=mike.kravetz@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=guro@fb.com \
--cc=jonathan.cameron@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linuxarm@huawei.com \
--cc=song.bao.hua@hisilicon.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;
as well as URLs for NNTP newsgroup(s).