From: Chengkaitao <pilgrimtao@gmail.com>
To: rppt@kernel.org, akpm@linux-foundation.org, david@kernel.org,
ljs@kernel.org, Liam.Howlett@oracle.com, vbabka@kernel.org,
surenb@google.com, mhocko@suse.com
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Kaitao Cheng <chengkaitao@kylinos.cn>
Subject: [PATCH] mm: Mark early-init static variables with __meminitdata
Date: Sat, 21 Mar 2026 20:08:47 +0800 [thread overview]
Message-ID: <20260321120847.8159-1-pilgrimtao@gmail.com> (raw)
From: Kaitao Cheng <chengkaitao@kylinos.cn>
Static variables defined inside __meminit functions should also be
marked with __meminitdata, so that their storage is placed in the
.init.data section and reclaimed with free_initmem(), thereby
reducing permanent .bss memory usage when CONFIG_MEMORY_HOTPLUG is
disabled.
Signed-off-by: Kaitao Cheng <chengkaitao@kylinos.cn>
---
mm/mm_init.c | 2 +-
mm/sparse-vmemmap.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/mm_init.c b/mm/mm_init.c
index df34797691bd..24420217522f 100644
--- a/mm/mm_init.c
+++ b/mm/mm_init.c
@@ -801,7 +801,7 @@ void __meminit reserve_bootmem_region(phys_addr_t start,
static bool __meminit
overlap_memmap_init(unsigned long zone, unsigned long *pfn)
{
- static struct memblock_region *r;
+ static struct memblock_region *r __meminitdata;
if (mirrored_kernelcore && zone == ZONE_MOVABLE) {
if (!r || *pfn >= memblock_region_memory_end_pfn(r)) {
diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c
index 37522d6cb398..ca05941463f4 100644
--- a/mm/sparse-vmemmap.c
+++ b/mm/sparse-vmemmap.c
@@ -62,7 +62,7 @@ void * __meminit vmemmap_alloc_block(unsigned long size, int node)
if (slab_is_available()) {
gfp_t gfp_mask = GFP_KERNEL|__GFP_RETRY_MAYFAIL|__GFP_NOWARN;
int order = get_order(size);
- static bool warned;
+ static bool warned __meminitdata;
struct page *page;
page = alloc_pages_node(node, gfp_mask, order);
--
2.50.1 (Apple Git-155)
reply other threads:[~2026-03-21 12:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260321120847.8159-1-pilgrimtao@gmail.com \
--to=pilgrimtao@gmail.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=chengkaitao@kylinos.cn \
--cc=david@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=rppt@kernel.org \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
/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