]> www.infradead.org Git - users/willy/linux.git/commit
mm, memory-hotplug: rework unregister_mem_sect_under_nodes
authorOscar Salvador <osalvador@suse.com>
Wed, 5 Dec 2018 00:13:50 +0000 (11:13 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 5 Dec 2018 00:13:50 +0000 (11:13 +1100)
commit7a6e597af23dfdbffdf1c5e44104116cb65806db
tree4bd0b78fc0fa48f9139d2f2aa3951c47c78a2f99
parentdd99d07f818b399089ea15ec21d65f55dc458219
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>
drivers/base/memory.c
drivers/base/node.c
include/linux/memory.h
include/linux/node.h
mm/memory_hotplug.c