mm, memory_hotplug: provide a more generic restrictions for memory hotplug

arch_add_memory, __add_pages take a want_memblock which controls whether
the newly added memory should get the sysfs memblock user API (e.g.
ZONE_DEVICE users do not want/need this interface).  Some callers even
want to control where do we allocate the memmap from by configuring

Add a more generic hotplug context for arch_add_memory and __add_pages.
struct mhp_restrictions contains flags which contains additional features
to be enabled by the memory hotplug (MHP_MEMBLOCK_API currently) and
altmap for alternative memmap allocator.

This patch shouldn't introduce any functional change.

[ build fix]
Signed-off-by: Michal Hocko <>
Signed-off-by: Oscar Salvador <>
Cc: Dan Williams <>
Cc: David Hildenbrand <>
Signed-off-by: Andrew Morton <>
Signed-off-by: Linus Torvalds <>
10 files changed