Mirrored regions are already skipped when initializing ZONE_MOVABLE, but overlapping PFNs can still be initialized from the ZONE_NORMAL path when ZONE_MOVABLE is present on the node. When zone_movable_pfn[nid] is set, skip ZONE_NORMAL initialization for non-mirrored regions, keep skipping mirrored regions for ZONE_MOVABLE. Reviewed-by: Wei Yang Reviewed-by: Jason Zeng Co-developed-by: Wei Yang Signed-off-by: Wei Yang Signed-off-by: Yuan Liu --- mm/mm_init.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/mm/mm_init.c b/mm/mm_init.c index 24e103a402b0..2a5ac175d5dd 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -941,9 +941,18 @@ static void __init memmap_init(void) if (!populated_zone(zone)) continue; - if (mirrored_kernelcore && j == ZONE_MOVABLE && - memblock_is_mirror(r)) - continue; + if (mirrored_kernelcore) { + /* + * Avoid double initialization of PFNs that overlap + * between Normal and Movable zones. + */ + if (j == ZONE_NORMAL && !memblock_is_mirror(r) && + zone_movable_pfn[nid]) + continue; + + if (j == ZONE_MOVABLE && memblock_is_mirror(r)) + continue; + } memmap_init_zone_range(zone, start_pfn, end_pfn, &hole_pfn); -- 2.47.3