Skip to content

Commit 1e5d8e1

Browse files
committed
x86/mm: Introduce CONFIG_NUMA_KEEP_MEMINFO
Currently x86 numa_meminfo is marked __initdata in the CONFIG_MEMORY_HOTPLUG=n case. In support of a new facility to allow drivers to map reserved memory to a 'target_node' (phys_to_target_node()), add support for removing the __initdata designation for those users. Both memory hotplug and phys_to_target_node() users select CONFIG_NUMA_KEEP_MEMINFO to tell the arch to maintain its physical address to NUMA mapping infrastructure post init. Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Borislav Petkov <bp@alien8.de> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: <x86@kernel.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: David Hildenbrand <david@redhat.com> Cc: Michal Hocko <mhocko@suse.com> Reviewed-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/158188326422.894464.15742054998046628934.stgit@dwillia2-desk3.amr.corp.intel.com
1 parent 575e23b commit 1e5d8e1

3 files changed

Lines changed: 13 additions & 5 deletions

File tree

‎arch/x86/mm/numa.c‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ nodemask_t numa_nodes_parsed __initdata;
2525
struct pglist_data *node_data[MAX_NUMNODES] __read_mostly;
2626
EXPORT_SYMBOL(node_data);
2727

28-
static struct numa_meminfo numa_meminfo
29-
#ifndef CONFIG_MEMORY_HOTPLUG
30-
__initdata
31-
#endif
32-
;
28+
static struct numa_meminfo numa_meminfo __initdata_or_meminfo;
3329

3430
static int numa_distance_cnt;
3531
static u8 *numa_distance;

‎include/linux/numa.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@
1313

1414
#define NUMA_NO_NODE (-1)
1515

16+
/* optionally keep NUMA memory info available post init */
17+
#ifdef CONFIG_NUMA_KEEP_MEMINFO
18+
#define __initdata_or_meminfo
19+
#else
20+
#define __initdata_or_meminfo __initdata
21+
#endif
22+
1623
#ifdef CONFIG_NUMA
1724
int numa_map_to_online_node(int node);
1825
#else

‎mm/Kconfig‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ config HAVE_FAST_GUP
139139
config ARCH_KEEP_MEMBLOCK
140140
bool
141141

142+
# Keep arch NUMA mapping infrastructure post-init.
143+
config NUMA_KEEP_MEMINFO
144+
bool
145+
142146
config MEMORY_ISOLATION
143147
bool
144148

@@ -154,6 +158,7 @@ config MEMORY_HOTPLUG
154158
bool "Allow for memory hot-add"
155159
depends on SPARSEMEM || X86_64_ACPI_NUMA
156160
depends on ARCH_ENABLE_MEMORY_HOTPLUG
161+
select NUMA_KEEP_MEMINFO if NUMA
157162

158163
config MEMORY_HOTPLUG_SPARSE
159164
def_bool y

0 commit comments

Comments
 (0)