This patch adds the Kconfig logic to add deferred memory initialisation
to x86-64 if NUMA is enabled. Other architectures should enable on a
case-by-case basis once the users of early_pfn_to_nid are audited and it
is tested.

Signed-off-by: Mel Gorman <[email protected]>
---
 arch/x86/Kconfig |  2 ++
 mm/Kconfig       | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index b7d31ca55187..830ad8450bbd 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -32,6 +32,8 @@ config X86
        select HAVE_UNSTABLE_SCHED_CLOCK
        select ARCH_SUPPORTS_NUMA_BALANCING if X86_64
        select ARCH_SUPPORTS_INT128 if X86_64
+       select ARCH_SUPPORTS_DEFERRED_MEM_INIT if X86_64 && NUMA
+       select ARCH_WANTS_PROT_NUMA_PROT_NONE
        select HAVE_IDE
        select HAVE_OPROFILE
        select HAVE_PCSPKR_PLATFORM
diff --git a/mm/Kconfig b/mm/Kconfig
index a03131b6ba8e..463c7005c3d9 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -629,3 +629,22 @@ config MAX_STACK_SIZE_MB
          changed to a smaller value in which case that is used.
 
          A sane initial value is 80 MB.
+
+# For architectures that was to support deferred memory initialisation
+config ARCH_SUPPORTS_DEFERRED_MEM_INIT
+       bool
+
+config DEFERRED_MEM_INIT
+       bool "Defer initialisation of memory to kswapd"
+       default n
+       depends on ARCH_SUPPORTS_DEFERRED_MEM_INIT
+       depends on MEMORY_HOTPLUG
+       help
+         Ordinarily all struct pages are initialised during early boot in a
+         single thread. On very large machines this can take a considerable
+         amount of time. If this option is set, large machines will bring up
+         a small amount of memory at boot and then initialise the rest when
+         kswapd starts. Boot times are reduced but very early in the lifetime
+         of the system it will still be busy initialising struct pages. This
+         has a potential performance impact on processes until kswapd finishes
+         the initialisation.
-- 
2.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to