On Mon, May 27, 2019 at 7:12 AM David Hildenbrand <[email protected]> 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 <[email protected]> > Cc: "Rafael J. Wysocki" <[email protected]> > Cc: David Hildenbrand <[email protected]> > Cc: "[email protected]" <[email protected]> > Cc: Andrew Morton <[email protected]> > Cc: Ingo Molnar <[email protected]> > Cc: Andrew Banman <[email protected]> > Cc: Oscar Salvador <[email protected]> > Cc: Michal Hocko <[email protected]> > Cc: Pavel Tatashin <[email protected]> > Cc: Qian Cai <[email protected]> > Cc: Wei Yang <[email protected]> > Cc: Arun KS <[email protected]> > Cc: Mathieu Malaterre <[email protected]> > Signed-off-by: David Hildenbrand <[email protected]>
LGTM Reviewed-by: Pavel Tatashin <[email protected]>

