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

From: Ben Dooks

Date: Mon Jun 29 2026 - 07:13:52 EST


On 25/06/2026 03:27, Andrew Morton wrote:
On Thu, 18 Jun 2026 11:06:14 +0100 Ben Dooks <ben.dooks@xxxxxxxxxxxxxxx> wrote:

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?

...

--- 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
/*

It might be tidier to move this into mm/vmstat.c, around line 38?

Is it worth sending a version of the patch?

--
Ben Dooks http://www.codethink.co.uk/
Senior Engineer Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html