mm/memory_hotplug: support memmap_on_memory when memmap is not aligned to pageblocks
authorAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Tue, 8 Aug 2023 09:14:59 +0000 (14:44 +0530)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 21 Aug 2023 20:37:49 +0000 (13:37 -0700)
commit2d1f649c7c0855751c7ff43f4e34784061bc72f7
treef426307c8ef50a508f332684a5d017d293c74da8
parent85a2b4b08f202d67be81e2453064e01572ec19c8
mm/memory_hotplug: support memmap_on_memory when memmap is not aligned to pageblocks

Currently, memmap_on_memory feature is only supported with memory block
sizes that result in vmemmap pages covering full page blocks.  This is
because memory onlining/offlining code requires applicable ranges to be
pageblock-aligned, for example, to set the migratetypes properly.

This patch helps to lift that restriction by reserving more pages than
required for vmemmap space.  This helps the start address to be page block
aligned with different memory block sizes.  Using this facility implies
the kernel will be reserving some pages for every memoryblock.  This
allows the memmap on memory feature to be widely useful with different
memory block size values.

For ex: with 64K page size and 256MiB memory block size, we require 4
pages to map vmemmap pages, To align things correctly we end up adding a
reserve of 28 pages.  ie, for every 4096 pages 28 pages get reserved.

Link: https://lkml.kernel.org/r/20230808091501.287660-5-aneesh.kumar@linux.ibm.com
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Vishal Verma <vishal.l.verma@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Documentation/admin-guide/mm/memory-hotplug.rst
mm/memory_hotplug.c