mm, memory-hotplug: rework unregister_mem_sect_under_nodes
This tries to address another issue about accessing unitiliazed pages.
Jonathan reported a problem [1] where we can access steal pages in case we
hot-remove memory without onlining it first.
This time is in unregister_mem_sect_under_nodes. This function tries to
get the nid from the pfn and then tries to remove the symlink between
mem_blk <-> nid and vice versa.
Since we already know the nid in remove_memory(), we can pass it down the
chain to unregister_mem_sect_under_nodes. There we can just remove the
symlinks without the need to look into the pages.
This also allows us to cleanup unregister_mem_sect_under_nodes.
[1] https://www.spinics.net/lists/linux-mm/msg161316.html
Link: http://lkml.kernel.org/r/20181127162005.15833-5-osalvador@suse.de
Signed-off-by: Oscar Salvador <osalvador@suse.de>
Tested-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Jerome Glisse <jglisse@redhat.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>