[Devel] [PATCH RHEL10 COMMIT] mm/vmstat: build the /proc/vmstat virtualization only with CONFIG_VE
Konstantin Khorenko
khorenko at virtuozzo.com
Fri Aug 21 19:42:14 MSK 2026
The commit is pushed to "branch-rh10-6.12.0-211.39.1.16.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh10-6.12.0-211.39.1.16.6.vz10
------>
commit 22b53c9453944fb0053512af4128df347b9de26c
Author: Eva Kurchatova <eva.kurchatova at virtuozzo.com>
Date: Fri Aug 21 18:36:57 2026 +0200
mm/vmstat: build the /proc/vmstat virtualization only with CONFIG_VE
fill_vmstat_ve() fills the Container view of /proc/vmstat from the
Container's memory cgroup, looked up by memory_cgrp_id. It is compiled
unconditionally, so with CONFIG_MEMCG=n - which CONFIG_VE=n allows, and
plain "make defconfig" used to produce - the build fails:
mm/vmstat.c: error: 'memory_cgrp_id' undeclared (first use in this
function)
CONFIG_VE selects CONFIG_MEMCG, so compile both the helper and its call
site under CONFIG_VE. The 've' variable moves into the guarded block:
left at function scope it would be unused with CONFIG_VE=n, which is a
build failure of its own once CONFIG_WERROR=y, as x86_64 defconfig has
it.
Fixes: e15a9e29a433 ("ve/memcg: Virtualize /proc/vmstat view inside CT")
Feature: procfs: virtualize /proc/vmstat
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova at virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
mm/vmstat.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 47cb6bf4ecec6..d97eb1d33f8a2 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1855,6 +1855,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;
@@ -1863,10 +1864,10 @@ 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;
@@ -1880,12 +1881,18 @@ static void *vmstat_start(struct seq_file *m, loff_t *pos)
if (!v)
return ERR_PTR(-ENOMEM);
- 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;
+#ifdef CONFIG_VE
+ {
+ struct ve_struct *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);
More information about the Devel
mailing list