Re: [PATCH 4/6] mm/hotplug: Reorder arch_remove_memory() call in __remove_memory()

From: Oscar Salvador
Date: Wed Apr 03 2019 - 04:45:15 EST


On Wed, Apr 03, 2019 at 10:00:04AM +0530, Anshuman Khandual wrote:
> Re-ordering arch_remove_memory() with memblock_[free|remove] solves the
> problem on arm64 as pfn_valid() behaves correctly and returns positive
> as memblock for the address range still exists. arch_remove_memory()
> removes applicable memory sections from zone with __remove_pages() and
> tears down kernel linear mapping. Removing memblock regions afterwards
> is consistent.
>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@xxxxxxx>

Yes, I cannot see a way of those two colliding with each other, and
a testing on my box did not raise anything spooky either.

Reviewed-by: Oscar Salvador <osalvador@xxxxxxx>

> ---
> mm/memory_hotplug.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 0082d69..71d0d79 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1872,11 +1872,10 @@ void __ref __remove_memory(int nid, u64 start, u64 size)
>
> /* remove memmap entry */
> firmware_map_remove(start, start + size, "System RAM");
> + arch_remove_memory(nid, start, size, NULL);
> memblock_free(start, size);
> memblock_remove(start, size);
>
> - arch_remove_memory(nid, start, size, NULL);
> -
> try_offline_node(nid);
>
> mem_hotplug_done();
> --
> 2.7.4
>

--
Oscar Salvador
SUSE L3