mm/memory_hotplug: shrink zones when offlining memory
We currently try to shrink a single zone when removing memory. We use the zone of the first page of the memory we are removing. If that memmap was never initialized (e.g., memory was never onlined), we will read garbage and can trigger kernel BUGs (due to a stale pointer): BUG: unable to handle page fault for address: 000000000000353d #PF: supervisor write access in kernel mode #PF: error_code(0x0002) - not-present page PGD 0 P4D 0 Oops: 0002 [#1] SMP PTI CPU: 1 PID: 7 Comm: kworker/u8:0 Not tainted 5.3.0-rc5-next-20190820+ #317 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.4 Workqueue: kacpi_hotplug acpi_hotplug_work_fn RIP: 0010:clear_zone_contiguous+0x5/0x10 Code: 48 89 c6 48 89 c3 e8 2a fe ff ff 48 85 c0 75 cf 5b 5d c3 c6 85 fd 05 00 00 01 5b 5d c3 0f 1f 840 RSP: 0018:ffffad2400043c98 EFLAGS: 00010246 RAX: 0000000000000000 RBX: 0000000200000000...
Showing
- arch/arm64/mm/mmu.c 1 addition, 3 deletionsarch/arm64/mm/mmu.c
- arch/ia64/mm/init.c 1 addition, 3 deletionsarch/ia64/mm/init.c
- arch/powerpc/mm/mem.c 1 addition, 2 deletionsarch/powerpc/mm/mem.c
- arch/s390/mm/init.c 1 addition, 3 deletionsarch/s390/mm/init.c
- arch/sh/mm/init.c 1 addition, 3 deletionsarch/sh/mm/init.c
- arch/x86/mm/init_32.c 1 addition, 3 deletionsarch/x86/mm/init_32.c
- arch/x86/mm/init_64.c 1 addition, 3 deletionsarch/x86/mm/init_64.c
- include/linux/memory_hotplug.h 5 additions, 2 deletionsinclude/linux/memory_hotplug.h
- mm/memory_hotplug.c 16 additions, 15 deletionsmm/memory_hotplug.c
- mm/memremap.c 1 addition, 1 deletionmm/memremap.c
Please register or sign in to comment