From a5d67c54d414ee707333ce179d4492e99122e5b6 Mon Sep 17 00:00:00 2001 From: Zhen Ni Date: Fri, 12 Jun 2026 11:11:05 +0800 Subject: [PATCH 1/3] mm/memblock: Remove redundant pageblock_align() in free_unused_memmap() The assignment `prev_end = pageblock_align(end)` is redundant because `prev_end` was already aligned to pageblock oundaries inside the loop. Since pageblock_align() is a pure function, calling it again with the same input produces the same result. This line was added in commit f921f53e089a ("memblock: align freed memory map on pageblock boundaries with SPARSEMEM"). Remove it to simplify the code. Signed-off-by: Zhen Ni Link: https://patch.msgid.link/20260612031105.3350181-1-zhen.ni@easystack.cn Signed-off-by: Mike Rapoport (Microsoft) --- mm/memblock.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mm/memblock.c b/mm/memblock.c index 6349c48154f4..43e036f3e11a 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -2224,10 +2224,8 @@ static void __init free_unused_memmap(void) } #ifdef CONFIG_SPARSEMEM - if (!IS_ALIGNED(prev_end, PAGES_PER_SECTION)) { - prev_end = pageblock_align(end); + if (!IS_ALIGNED(prev_end, PAGES_PER_SECTION)) free_memmap(prev_end, ALIGN(prev_end, PAGES_PER_SECTION)); - } #endif } From d7bfd98ba01d2af48cc238d5525201c83fdef251 Mon Sep 17 00:00:00 2001 From: Sang-Heon Jeon Date: Tue, 21 Jul 2026 00:09:13 +0900 Subject: [PATCH 2/3] mm/mm_init: remove redundant memset in free_area_init() zone_movable_pfn is zero-initialized and only set by find_zone_movable_pfns_for_nodes(), which runs once during boot right after the memset, so the memset has no effect. Remove redundant memset. No functional change. Signed-off-by: Sang-Heon Jeon Link: https://patch.msgid.link/20260720150915.756749-1-ekffu200098@gmail.com Signed-off-by: Mike Rapoport (Microsoft) --- mm/mm_init.c | 1 - 1 file changed, 1 deletion(-) diff --git a/mm/mm_init.c b/mm/mm_init.c index 0f64909e8d20..10eda88bf476 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -1836,7 +1836,6 @@ static void __init free_area_init(void) } /* Find the PFNs that ZONE_MOVABLE begins at in each node */ - memset(zone_movable_pfn, 0, sizeof(zone_movable_pfn)); find_zone_movable_pfns_for_nodes(); /* Print out the zone ranges */ From 78fac571b06490654af45c902c7ab5f651fe7067 Mon Sep 17 00:00:00 2001 From: Sang-Heon Jeon Date: Thu, 30 Jul 2026 00:51:15 +0900 Subject: [PATCH 3/3] mm/mm_init: remove unnecessary initialization of pgdat->per_cpu_nodestats free_area_init_node() sets pgdat->per_cpu_nodestats to NULL and later calls free_area_init_core(), which unconditionally overwrites it with &boot_nodestats. Nothing reads the field in between, so the store has no effect. Remove unnecessary initialization. No functional change. Signed-off-by: Sang-Heon Jeon Link: https://patch.msgid.link/20260729155143.177790-1-ekffu200098@gmail.com Signed-off-by: Mike Rapoport (Microsoft) --- mm/mm_init.c | 1 - 1 file changed, 1 deletion(-) diff --git a/mm/mm_init.c b/mm/mm_init.c index 10eda88bf476..acba6b30b535 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -1713,7 +1713,6 @@ static void __init free_area_init_node(int nid) pgdat->node_id = nid; pgdat->node_start_pfn = start_pfn; - pgdat->per_cpu_nodestats = NULL; if (start_pfn != end_pfn) { pr_info("Initmem setup node %d [mem %#018Lx-%#018Lx]\n", nid,