[Devel] [RFC 41/54] vmstat: fix CONFIG_VE=n build

Eva Kurchatova eva.kurchatova at virtuozzo.com
Wed Apr 29 22:58:41 MSK 2026


Signed-off-by: Eva Kurchatova <eva.kurchatova at virtuozzo.com>
---
 mm/vmstat.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/mm/vmstat.c b/mm/vmstat.c
index 91dc0e0a09a9..41e197c73f3e 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1846,6 +1846,7 @@ static const struct seq_operations zoneinfo_op = {
 			 (IS_ENABLED(CONFIG_VM_EVENT_COUNTERS) ? \
 			  NR_VM_EVENT_ITEMS : 0))
 
+#ifdef CONFIG_VE
 static void fill_vmstat_ve(unsigned long *stat, struct ve_struct *ve)
 {
 	struct cgroup_subsys_state *css;
@@ -1854,12 +1855,15 @@ static void fill_vmstat_ve(unsigned long *stat, struct ve_struct *ve)
 	mem_cgroup_fill_vmstat(mem_cgroup_from_css(css), stat);
 	css_put(css);
 }
+#endif
 
 static void *vmstat_start(struct seq_file *m, loff_t *pos)
 {
-	struct ve_struct *ve;
 	unsigned long *v;
 	int i;
+#ifdef CONFIG_VE
+	struct ve_struct *ve;
+#endif
 
 	if (*pos >= NR_VMSTAT_ITEMS)
 		return NULL;
@@ -1870,14 +1874,14 @@ static void *vmstat_start(struct seq_file *m, loff_t *pos)
 	m->private = v;
 	if (!v)
 		return ERR_PTR(-ENOMEM);
-
+#ifdef CONFIG_VE
 	ve = get_exec_env();
 	if (!ve_is_super(ve)) {
 		memset(v, 0, NR_VMSTAT_ITEMS * sizeof(unsigned long));
 		fill_vmstat_ve(v, ve);
 		return (unsigned long *)m->private + *pos;
 	}
-
+#endif
 	for (i = 0; i < NR_VM_ZONE_STAT_ITEMS; i++)
 		v[i] = global_zone_page_state(i);
 	v += NR_VM_ZONE_STAT_ITEMS;
-- 
2.54.0



More information about the Devel mailing list