Skip to contentSkip to conversation

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

PATCH Applied Ben Dooks 5 participants 6 messages Jun 18 – Jun 29

Subsystems (2)
lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

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

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?

---
 mm/page_alloc.c | 2 ++
 1 file changed, 2 insertions(+)
mm/page_alloc.c +2 -0
index d49c254174da..b7d303a94cc1 100644
@@ -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
 /*
Signature · 1 line
2.37.2.352.g3c44437643
reviewer Reviewed-by on v1 1/1
#2 lore raw
In reply to Ben Dooks
Quoted 11 lines · Ben Dooks

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?

---
 mm/page_alloc.c | 2 ++
 1 file changed, 2 insertions(+)

LGTM. Thanks.

Signature · 2 lines
Best Regards,
Yan, Zi
Reviewed-by on v1 1/1
#3 lore raw
In reply to Ben Dooks
Quoted 3 lines · On Thu, 18 Jun 2026 11:06:14 +0100 Ben Dooks <[email protected]> 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:

Makes sense.

Quoted 4 lines

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

Thanks,
SJ

[...]

maintainer
#4 lore raw
In reply to Ben Dooks
Quoted 11 lines · On Thu, 18 Jun 2026 11:06:14 +0100 Ben Dooks <[email protected]> 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?

...

mm/page_alloc.c DEFINE_PER_CPU(int, numa_node); · line 170

Quoted 9 lines
mm/page_alloc.c +2 -0
@@ -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?

author
#5 lore raw
Quoted 16 lines · Andrew Morton
Quoted 14 lines · On Thu, 18 Jun 2026 11:06:14 +0100 Ben Dooks <[email protected]> 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?

...

mm/page_alloc.c +0 -0
@@ -162,7 +162,9 @@ DEFINE_PER_CPU(int, numa_node);
  EXPORT_PER_CPU_SYMBOL(numa_node);
  #endif
 
Quoted 8 lines

mm/page_alloc.c DEFINE_PER_CPU(int, numa_node); · line 170

Quoted 6 lines
mm/page_alloc.c +2 -0
+#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?

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

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