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

From: Andrew Morton

Date: Wed Jun 24 2026 - 22:27:47 EST


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?