Skip to contentSkip to conversation

mm/page_alloc: include <linux/vmstat.h> for vm_numa_stat_key

PATCH In review Ben Dooks 2 participants 4 messages Jun 17 – Jun 18

Subsystems (2)
lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

PATCH 1/1 mm/page_alloc: include <linux/vmstat.h> for vm_numa_stat_key

The vm_numa_stat_key is declared in <linux/vmstat.h> but this is currently not included in mm/page_alloc.c so include it to fix the following sparse warning:

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

---
 mm/page_alloc.c | 1 +
 1 file changed, 1 insertion(+)
mm/page_alloc.c +1 -0
index d49c254174da..58aa960a8dd0 100644
@@ -54,6 +54,7 @@
 #include <linux/delayacct.h>
 #include <linux/cacheinfo.h>
 #include <linux/pgalloc_tag.h>
+#include <linux/vmstat.h>
 #include <asm/div64.h>
 #include "internal.h"
 #include "shuffle.h"
Signature · 1 line
2.37.2.352.g3c44437643
reviewer
#1 lore raw
Quoted 11 lines · Ben Dooks

The vm_numa_stat_key is declared in <linux/vmstat.h> but this is currently not included in mm/page_alloc.c so include it to fix the following sparse warning:

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

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

vmstat.h is already included at line 37[1].

I wonder why sparse complains and why adding a duplicated one below fixes it.

[1] https://elixir.bootlin.com/linux/v7.1/source/mm/page_alloc.c#L37

Best Regards,
Yan, Zi

author
#2 lore raw
Quoted 13 lines · Zi Yan
Quoted 11 lines · Ben Dooks

The vm_numa_stat_key is declared in <linux/vmstat.h> but this is currently not included in mm/page_alloc.c so include it to fix the following sparse warning:

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

---
 mm/page_alloc.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 4 lines

vmstat.h is already included at line 37[1].

I wonder why sparse complains and why adding a duplicated one below fixes it.

I'll check, maybe the order is an issue here?

Quoted 4 lines

[1] https://elixir.bootlin.com/linux/v7.1/source/mm/page_alloc.c#L37

Best Regards,
Yan, Zi

author
#3 lore raw
In reply to Zi Yan
Quoted 13 lines · Zi Yan
Quoted 11 lines · Ben Dooks

The vm_numa_stat_key is declared in <linux/vmstat.h> but this is currently not included in mm/page_alloc.c so include it to fix the following sparse warning:

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

---
  mm/page_alloc.c | 1 +
  1 file changed, 1 insertion(+)
Quoted 4 lines

vmstat.h is already included at line 37[1].

I wonder why sparse complains and why adding a duplicated one below fixes it.

Thanks for catching this, it turns out this warning is coming from the riscv64 build and I re-ran the arm64 thinking this had been fixed. The issue is actually riscv64 does not default CONFIG_NUMA which then does not define the 'vm_numa_stat_key' but mm/page_alloc.c creates in anyway.

Will re-test by guarding 'vm_numa_stat_key' with CONFIG_NUMA

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

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