[RFC Patch 3/3] mm/mm_init: remove special handling absent pages for mirrored_kernelcore

From: Wei Yang

Date: Tue Jun 23 2026 - 05:26:37 EST


After making Zone Normal/Movable non-overlap, it is not necessary to
calculate absent pages for mirrored_kernelcore specially.

Signed-off-by: Wei Yang <richard.weiyang@xxxxxxxxx>
Cc: "David Hildenbrand (Arm)" <david@xxxxxxxxxx>
Cc: Yuan Liu <yuan1.liu@xxxxxxxxx>
---
mm/mm_init.c | 31 +------------------------------
1 file changed, 1 insertion(+), 30 deletions(-)

diff --git a/mm/mm_init.c b/mm/mm_init.c
index da0e65bf8d02..b34ca1cf117f 100644
--- a/mm/mm_init.c
+++ b/mm/mm_init.c
@@ -1195,40 +1195,11 @@ static unsigned long __init zone_absent_pages_in_node(int nid,
unsigned long zone_start_pfn,
unsigned long zone_end_pfn)
{
- unsigned long nr_absent;
-
/* zone is empty, we don't have any absent pages */
if (zone_start_pfn == zone_end_pfn)
return 0;

- nr_absent = __absent_pages_in_range(nid, zone_start_pfn, zone_end_pfn);
-
- /*
- * ZONE_MOVABLE handling.
- * Treat pages to be ZONE_MOVABLE in ZONE_NORMAL as absent pages
- * and vice versa.
- */
- if (mirrored_kernelcore && zone_movable_pfn[nid]) {
- unsigned long start_pfn, end_pfn;
- struct memblock_region *r;
-
- for_each_mem_region(r) {
- start_pfn = clamp(memblock_region_memory_base_pfn(r),
- zone_start_pfn, zone_end_pfn);
- end_pfn = clamp(memblock_region_memory_end_pfn(r),
- zone_start_pfn, zone_end_pfn);
-
- if (zone_type == ZONE_MOVABLE &&
- memblock_is_mirror(r))
- nr_absent += end_pfn - start_pfn;
-
- if (zone_type == ZONE_NORMAL &&
- !memblock_is_mirror(r))
- nr_absent += end_pfn - start_pfn;
- }
- }
-
- return nr_absent;
+ return __absent_pages_in_range(nid, zone_start_pfn, zone_end_pfn);
}

/*
--
2.34.1