Skip to contentSkip to conversation

mm: Mark early-init static variables with __meminitdata

PATCH Applied Chengkaitao 1 participant 1 message Mar 21

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm: Mark early-init static variables with __meminitdata

From: Kaitao Cheng <[email protected]>

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.

---
 mm/mm_init.c        | 2 +-
 mm/sparse-vmemmap.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
mm/mm_init.c +1 -1
index df34797691bd..24420217522f 100644
@@ -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)) {
mm/sparse-vmemmap.c +1 -1
index 37522d6cb398..ca05941463f4 100644
@@ -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);
Signature · 1 line
2.50.1 (Apple Git-155)