Commit 22eb6346 authored by David Hildenbrand's avatar David Hildenbrand Committed by Linus Torvalds
Browse files

arm64/mm: add temporary arch_remove_memory() implementation

A proper arch_remove_memory() implementation is on its way, which also
cleanly removes page tables in arch_add_memory() in case something goes

As we want to use arch_remove_memory() in case something goes wrong
during memory hotplug after arch_add_memory() finished, let's add a
temporary hack that is sufficient enough until we get a proper
implementation that cleans up page table entries.

We will remove CONFIG_MEMORY_HOTREMOVE around this code in follow up


Signed-off-by: default avatarDavid Hildenbrand <>
Cc: Catalin Marinas <>
Cc: Will Deacon <>
Cc: Mark Rutland <>
Cc: Ard Biesheuvel <>
Cc: Chintan Pandya <>
Cc: Mike Rapoport <>
Cc: Jun Yao <>
Cc: Yu Zhao <>
Cc: Robin Murphy <>
Cc: Anshuman Khandual <>
Cc: Alex Deucher <>
Cc: Andrew Banman <>
Cc: Andy Lutomirski <>
Cc: Arun KS <>
Cc: Baoquan He <>
Cc: Benjamin Herrenschmidt <>
Cc: Borislav Petkov <>
Cc: Christophe Leroy <>
Cc: Chris Wilson <>
Cc: Dan Williams <>
Cc: Dave Hansen <>
Cc: "David S. Miller" <>
Cc: Fenghua Yu <>
Cc: Greg Kroah-Hartman <>
Cc: Heiko Carstens <>
Cc: "H. Peter Anvin" <>
Cc: Ingo Molnar <>
Cc: Jonathan Cameron <>
Cc: Joonsoo Kim <>
Cc: "Kirill A. Shutemov" <>
Cc: Logan Gunthorpe <>
Cc: Mark Brown <>
Cc: Masahiro Yamada <>
Cc: Mathieu Malaterre <>
Cc: Michael Ellerman <>
Cc: Michal Hocko <>
Cc: Mike Rapoport <>
Cc: "" <>
Cc: Nicholas Piggin <>
Cc: Oscar Salvador <>
Cc: Oscar Salvador <>
Cc: Paul Mackerras <>
Cc: Pavel Tatashin <>
Cc: Peter Zijlstra <>
Cc: Qian Cai <>
Cc: "Rafael J. Wysocki" <>
Cc: Rich Felker <>
Cc: Rob Herring <>
Cc: Thomas Gleixner <>
Cc: Tony Luck <>
Cc: Vasily Gorbik <>
Cc: Wei Yang <>
Cc: Yoshinori Sato <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 18c86506
......@@ -1074,4 +1074,23 @@ int arch_add_memory(int nid, u64 start, u64 size,
return __add_pages(nid, start >> PAGE_SHIFT, size >> PAGE_SHIFT,
void arch_remove_memory(int nid, u64 start, u64 size,
struct vmem_altmap *altmap)
unsigned long start_pfn = start >> PAGE_SHIFT;
unsigned long nr_pages = size >> PAGE_SHIFT;
struct zone *zone;
* FIXME: Cleanup page tables (also in arch_add_memory() in case
* adding fails). Until then, this function should only be used
* during memory hotplug (adding memory), not for memory
* unplug. ARCH_ENABLE_MEMORY_HOTREMOVE must not be
* unlocked yet.
zone = page_zone(pfn_to_page(start_pfn));
__remove_pages(zone, start_pfn, nr_pages, altmap);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment