From: Muchun Song <songmuchun@bytedance.com>
To: mike.kravetz@oracle.com, akpm@linux-foundation.org, david@redhat.com
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
smuchun@bytedance.com, Muchun Song <songmuchun@bytedance.com>
Subject: [PATCH 2/3] mm: hugetlb_vmemmap: cleanup hugetlb_free_vmemmap_enabled*
Date: Mon, 4 Apr 2022 15:46:51 +0800 [thread overview]
Message-ID: <20220404074652.68024-3-songmuchun@bytedance.com> (raw)
In-Reply-To: <20220404074652.68024-1-songmuchun@bytedance.com>
The word of "free" is not expressive enough to express the feature of optimizing
vmemmap pages associated with each HugeTLB, rename this keywork to "optimeze".
In this patch , cheanup the static key and hugetlb_free_vmemmap_enabled() to make
code more expressive.
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
---
arch/arm64/mm/flush.c | 2 +-
include/linux/page-flags.h | 12 ++++++------
mm/hugetlb_vmemmap.c | 10 +++++-----
mm/memory_hotplug.c | 2 +-
4 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c
index 1efd01e10cba..d19a13234a81 100644
--- a/arch/arm64/mm/flush.c
+++ b/arch/arm64/mm/flush.c
@@ -85,7 +85,7 @@ void flush_dcache_page(struct page *page)
* set since the head vmemmap page frame is reused (more details can
* refer to the comments above page_fixed_fake_head()).
*/
- if (hugetlb_free_vmemmap_enabled() && PageHuge(page))
+ if (hugetlb_optimize_vmemmap_enabled() && PageHuge(page))
page = compound_head(page);
if (test_bit(PG_dcache_clean, &page->flags))
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 9f488668a1d7..557d15ef3dc0 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -201,16 +201,16 @@ enum pageflags {
#ifdef CONFIG_HUGETLB_PAGE_FREE_VMEMMAP
DECLARE_STATIC_KEY_MAYBE(CONFIG_HUGETLB_PAGE_FREE_VMEMMAP_DEFAULT_ON,
- hugetlb_free_vmemmap_enabled_key);
+ hugetlb_optimize_vmemmap_key);
-static __always_inline bool hugetlb_free_vmemmap_enabled(void)
+static __always_inline bool hugetlb_optimize_vmemmap_enabled(void)
{
return static_branch_maybe(CONFIG_HUGETLB_PAGE_FREE_VMEMMAP_DEFAULT_ON,
- &hugetlb_free_vmemmap_enabled_key);
+ &hugetlb_optimize_vmemmap_key);
}
/*
- * If the feature of freeing some vmemmap pages associated with each HugeTLB
+ * If the feature of optimizing vmemmap pages associated with each HugeTLB
* page is enabled, the head vmemmap page frame is reused and all of the tail
* vmemmap addresses map to the head vmemmap page frame (furture details can
* refer to the figure at the head of the mm/hugetlb_vmemmap.c). In other
@@ -227,7 +227,7 @@ static __always_inline bool hugetlb_free_vmemmap_enabled(void)
*/
static __always_inline const struct page *page_fixed_fake_head(const struct page *page)
{
- if (!hugetlb_free_vmemmap_enabled())
+ if (!hugetlb_optimize_vmemmap_enabled())
return page;
/*
@@ -256,7 +256,7 @@ static inline const struct page *page_fixed_fake_head(const struct page *page)
return page;
}
-static inline bool hugetlb_free_vmemmap_enabled(void)
+static inline bool hugetlb_optimize_vmemmap_enabled(void)
{
return false;
}
diff --git a/mm/hugetlb_vmemmap.c b/mm/hugetlb_vmemmap.c
index 91b79b9d9e25..f25294973398 100644
--- a/mm/hugetlb_vmemmap.c
+++ b/mm/hugetlb_vmemmap.c
@@ -189,8 +189,8 @@
#define RESERVE_VMEMMAP_SIZE (RESERVE_VMEMMAP_NR << PAGE_SHIFT)
DEFINE_STATIC_KEY_MAYBE(CONFIG_HUGETLB_PAGE_FREE_VMEMMAP_DEFAULT_ON,
- hugetlb_free_vmemmap_enabled_key);
-EXPORT_SYMBOL(hugetlb_free_vmemmap_enabled_key);
+ hugetlb_optimize_vmemmap_key);
+EXPORT_SYMBOL(hugetlb_optimize_vmemmap_key);
static int __init hugetlb_vmemmap_early_param(char *buf)
{
@@ -204,9 +204,9 @@ static int __init hugetlb_vmemmap_early_param(char *buf)
return -EINVAL;
if (!strcmp(buf, "on"))
- static_branch_enable(&hugetlb_free_vmemmap_enabled_key);
+ static_branch_enable(&hugetlb_optimize_vmemmap_key);
else if (!strcmp(buf, "off"))
- static_branch_disable(&hugetlb_free_vmemmap_enabled_key);
+ static_branch_disable(&hugetlb_optimize_vmemmap_key);
else
return -EINVAL;
@@ -282,7 +282,7 @@ void __init hugetlb_vmemmap_init(struct hstate *h)
BUILD_BUG_ON(__NR_USED_SUBPAGE >=
RESERVE_VMEMMAP_SIZE / sizeof(struct page));
- if (!hugetlb_free_vmemmap_enabled())
+ if (!hugetlb_optimize_vmemmap_enabled())
return;
vmemmap_pages = (nr_pages * sizeof(struct page)) >> PAGE_SHIFT;
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 3fb4196094d9..74430f88853d 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1273,7 +1273,7 @@ bool mhp_supports_memmap_on_memory(unsigned long size)
* populate a single PMD.
*/
return memmap_on_memory &&
- !hugetlb_free_vmemmap_enabled() &&
+ !hugetlb_optimize_vmemmap_enabled() &&
IS_ENABLED(CONFIG_MHP_MEMMAP_ON_MEMORY) &&
size == memory_block_size_bytes() &&
IS_ALIGNED(vmemmap_size, PMD_SIZE) &&
--
2.11.0
next prev parent reply other threads:[~2022-04-04 7:48 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-04 7:46 [PATCH 0/3] cleanup hugetlb_vmemmap Muchun Song
2022-04-04 7:46 ` [PATCH 1/3] mm: hugetlb_vmemmap: cleanup hugetlb_vmemmap related functions Muchun Song
2022-05-31 23:47 ` Mike Kravetz
2022-05-31 23:58 ` Mike Kravetz
2022-06-01 9:28 ` David Hildenbrand
2022-06-01 10:48 ` Muchun Song
2022-06-01 10:49 ` David Hildenbrand
2022-04-04 7:46 ` Muchun Song [this message]
2022-06-01 0:01 ` [PATCH 2/3] mm: hugetlb_vmemmap: cleanup hugetlb_free_vmemmap_enabled* Mike Kravetz
2022-06-01 9:29 ` David Hildenbrand
2022-04-04 7:46 ` [PATCH 3/3] mm: hugetlb_vmemmap: cleanup CONFIG_HUGETLB_PAGE_FREE_VMEMMAP* Muchun Song
2022-05-27 7:39 ` Vlastimil Babka
2022-05-27 7:47 ` Muchun Song
2022-06-01 0:20 ` Mike Kravetz
2022-06-01 9:32 ` David Hildenbrand
2022-06-01 9:54 ` Muchun Song
2022-06-01 10:10 ` David Hildenbrand
2022-06-01 11:56 ` Muchun Song
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=20220404074652.68024-3-songmuchun@bytedance.com \
--to=songmuchun@bytedance.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=smuchun@bytedance.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