On Mon, May 27, 2019 at 7:12 AM David Hildenbrand <da...@redhat.com> wrote: > > Only memory to be added to the buddy and to be onlined/offlined by > user space using /sys/devices/system/memory/... needs (and should have!) > memory block devices. > > Factor out creation of memory block devices. Create all devices after > arch_add_memory() succeeded. We can later drop the want_memblock parameter, > because it is now effectively stale. > > Only after memory block devices have been added, memory can be onlined > by user space. This implies, that memory is not visible to user space at > all before arch_add_memory() succeeded. > > While at it > - use WARN_ON_ONCE instead of BUG_ON in moved unregister_memory() > - introduce find_memory_block_by_id() to search via block id > - Use find_memory_block_by_id() in init_memory_block() to catch > duplicates > > Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org> > Cc: "Rafael J. Wysocki" <raf...@kernel.org> > Cc: David Hildenbrand <da...@redhat.com> > Cc: "mike.tra...@hpe.com" <mike.tra...@hpe.com> > Cc: Andrew Morton <a...@linux-foundation.org> > Cc: Ingo Molnar <mi...@kernel.org> > Cc: Andrew Banman <andrew.ban...@hpe.com> > Cc: Oscar Salvador <osalva...@suse.de> > Cc: Michal Hocko <mho...@suse.com> > Cc: Pavel Tatashin <pasha.tatas...@soleen.com> > Cc: Qian Cai <c...@lca.pw> > Cc: Wei Yang <richard.weiy...@gmail.com> > Cc: Arun KS <aru...@codeaurora.org> > Cc: Mathieu Malaterre <ma...@debian.org> > Signed-off-by: David Hildenbrand <da...@redhat.com>
LGTM Reviewed-by: Pavel Tatashin <pasha.tatas...@soleen.com>