[PATCH v3 0/1] mm: memmap defer init dosn't work as expected

From: Baoquan He
Date: Wed Dec 23 2020 - 03:09:50 EST


Post the regression fix in a standalone patch as Andrew suggested for
-stable branch better back porting. This is rebased on the latest
master branch of mainline kenrel, surely there's almost no change
comparing with v2.
https://lore.kernel.org/linux-mm/20201220082754.6900-1-bhe@xxxxxxxxxx/

Tested on a system with 24G ram as below, adding 'memmap=128M!0x500000000'
to split the one ram region into two regions in numa node1 to simulate
the scenario of VMware.

[ +0.000000] BIOS-provided physical RAM map:
[ +0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009bfff] usable
[ +0.000000] BIOS-e820: [mem 0x000000000009c000-0x000000000009ffff] reserved
[ +0.000000] BIOS-e820: [mem 0x00000000000e0000-0x00000000000fffff] reserved
[ +0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000006cdcefff] usable
[ +0.000000] BIOS-e820: [mem 0x000000006cdcf000-0x000000006efcefff] reserved
[ +0.000000] BIOS-e820: [mem 0x000000006efcf000-0x000000006fdfefff] ACPI NVS
[ +0.000000] BIOS-e820: [mem 0x000000006fdff000-0x000000006fffefff] ACPI data
[ +0.000000] BIOS-e820: [mem 0x000000006ffff000-0x000000006fffffff] usable
[ +0.000000] BIOS-e820: [mem 0x0000000070000000-0x000000008fffffff] reserved
[ +0.000000] BIOS-e820: [mem 0x00000000e0000000-0x00000000ffffffff] reserved
[ +0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000067f1fffff] usable
[ +0.000000] BIOS-e820: [mem 0x000000067f200000-0x000000067fffffff] reserved

Test passed as below. As you can see, with patch applied, memmap init
will cost much less time on numa node 1:

Without the patch:
[ 0.065029] Early memory node ranges
[ 0.065030] node 0: [mem 0x0000000000001000-0x000000000009bfff]
[ 0.065032] node 0: [mem 0x0000000000100000-0x000000006cdcefff]
[ 0.065034] node 0: [mem 0x000000006ffff000-0x000000006fffffff]
[ 0.065036] node 0: [mem 0x0000000100000000-0x000000027fffffff]
[ 0.065038] node 1: [mem 0x0000000280000000-0x00000004ffffffff]
[ 0.065040] node 1: [mem 0x0000000508000000-0x000000067f1fffff]
[ 0.065185] Zeroed struct page in unavailable ranges: 16533 pages
[ 0.065187] Initmem setup node 0 [mem 0x0000000000001000-0x000000027fffffff]
[ 0.069616] Initmem setup node 1 [mem 0x0000000280000000-0x000000067f1fffff]
[ 0.096298] ACPI: PM-Timer IO Port: 0x408

With the patch applied:
[ 0.065029] Early memory node ranges
[ 0.065030] node 0: [mem 0x0000000000001000-0x000000000009bfff]
[ 0.065032] node 0: [mem 0x0000000000100000-0x000000006cdcefff]
[ 0.065034] node 0: [mem 0x000000006ffff000-0x000000006fffffff]
[ 0.065036] node 0: [mem 0x0000000100000000-0x000000027fffffff]
[ 0.065038] node 1: [mem 0x0000000280000000-0x00000004ffffffff]
[ 0.065041] node 1: [mem 0x0000000508000000-0x000000067f1fffff]
[ 0.065187] Zeroed struct page in unavailable ranges: 16533 pages
[ 0.065189] Initmem setup node 0 [mem 0x0000000000001000-0x000000027fffffff]
[ 0.069572] Initmem setup node 1 [mem 0x0000000280000000-0x000000067f1fffff]
[ 0.070161] ACPI: PM-Timer IO Port: 0x408


Baoquan He (1):
mm: memmap defer init dosn't work as expected

arch/ia64/mm/init.c | 4 ++--
include/linux/mm.h | 5 +++--
mm/memory_hotplug.c | 2 +-
mm/page_alloc.c | 8 +++++---
4 files changed, 11 insertions(+), 8 deletions(-)

--
2.17.2