[PATCH] mm/page_alloc: don't build vm_numa_stat_key if CONFIG_NUMA=n

From: Ben Dooks

Date: Thu Jun 18 2026 - 06:07:38 EST


The vm_numa_stat_key is only exported if CONFIG_NUMA is set,
so avoid the following warning by guarding it in an #ifdef
on CONFIG_NUMA:

mm/page_alloc.c:165:1: warning: symbol 'vm_numa_stat_key' was not declared. Should it be static?

Signed-off-by: Ben Dooks <ben.dooks@xxxxxxxxxxxxxxx>
---
mm/page_alloc.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index d49c254174da..b7d303a94cc1 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -162,7 +162,9 @@ DEFINE_PER_CPU(int, numa_node);
EXPORT_PER_CPU_SYMBOL(numa_node);
#endif

+#ifdef CONFIG_NUMA
DEFINE_STATIC_KEY_TRUE(vm_numa_stat_key);
+#endif

#ifdef CONFIG_HAVE_MEMORYLESS_NODES
/*
--
2.37.2.352.g3c44437643