[Devel] [PATCH RHEL10 COMMIT] mm, proc: build the /proc/meminfo virtualization only with CONFIG_VE
Konstantin Khorenko
khorenko at virtuozzo.com
Fri Aug 21 19:42:13 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 3bb167409cb19772fcb7e26a2a51afd77ef4dd1c
Author: Eva Kurchatova <eva.kurchatova at virtuozzo.com>
Date: Fri Aug 21 18:36:56 2026 +0200
mm, proc: build the /proc/meminfo virtualization only with CONFIG_VE
The Container view of /proc/meminfo is built from the memory cgroup of
the Container: si_meminfo_ve() reads memcg->memory / memcg->memsw and
fill_meminfo_ve() looks the cgroup up by memory_cgrp_id. Both are
compiled unconditionally, so with CONFIG_MEMCG=n - which CONFIG_VE=n
allows, and plain "make defconfig" used to produce - the build fails:
mm/show_mem.c: error: 'memory_cgrp_id' undeclared (first use in this
function)
CONFIG_VE selects CONFIG_MEMCG, so CONFIG_VE is the condition to guard
with, and it is the better one anyway: with CONFIG_VE=n the Container view
is dead code even where CONFIG_MEMCG is on. Compile si_meminfo_ve(),
fill_meminfo_ve() and the code that formats that view under it.
meminfo_proc_show_mi() has to go under the same guard as its only caller,
or it is left as an unused static function - an error rather than a
warning in a CONFIG_VE=n build with CONFIG_WERROR=y, which x86_64
defconfig sets.
The callers of si_meminfo_ve() in do_sysinfo() and swaps_open() are
reached only when !ve_is_super(get_exec_env()), which is a compile-time
false with CONFIG_VE=n, so the compiler drops those branches and no stub
is needed.
Fixes: 7710faa9d4f0 ("ve/proc: virtualize /proc/meminfo in a Container")
Feature: procfs: virtualize /proc/meminfo
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>
---
fs/proc/meminfo.c | 4 ++++
mm/show_mem.c | 2 ++
2 files changed, 6 insertions(+)
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index ac3c88e68728a..27e8f921f31af 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -34,6 +34,7 @@ static void show_val_kb(struct seq_file *m, const char *s, unsigned long num)
seq_write(m, " kB\n", 4);
}
+#ifdef CONFIG_VE
static int meminfo_proc_show_mi(struct seq_file *m, struct meminfo *mi)
{
unsigned long *pages;
@@ -84,6 +85,7 @@ static void fill_meminfo_ve(struct meminfo *mi, struct ve_struct *ve)
css_put(css);
}
+#endif /* CONFIG_VE */
static int meminfo_proc_show_ve(struct seq_file *m, void *v,
struct ve_struct *ve)
@@ -104,11 +106,13 @@ static int meminfo_proc_show_ve(struct seq_file *m, void *v,
mi.si = &i;
mi.ve = ve;
+#ifdef CONFIG_VE
if (!ve_is_super(ve) && ve->meminfo_val == VE_MEMINFO_DEFAULT) {
fill_meminfo_ve(&mi, ve);
return meminfo_proc_show_mi(m, &mi);
}
+#endif
committed = vm_memory_committed();
diff --git a/mm/show_mem.c b/mm/show_mem.c
index 3ab11c945bf4a..15be6c6050e4d 100644
--- a/mm/show_mem.c
+++ b/mm/show_mem.c
@@ -91,6 +91,7 @@ void si_meminfo(struct sysinfo *val)
EXPORT_SYMBOL(si_meminfo);
+#ifdef CONFIG_VE
void si_meminfo_ve(struct sysinfo *si, struct ve_struct *ve)
{
unsigned long memtotal, memused, swaptotal, swapused;
@@ -138,6 +139,7 @@ void si_meminfo_ve(struct sysinfo *si, struct ve_struct *ve)
/* bufferram, totalhigh and freehigh left 0 */
}
EXPORT_SYMBOL(si_meminfo_ve);
+#endif /* CONFIG_VE */
#ifdef CONFIG_NUMA
void si_meminfo_node(struct sysinfo *val, int nid)
More information about the Devel
mailing list