[Devel] [PATCH RHEL10 COMMIT] proc: build the per-Container oom_score limit lookup only with CONFIG_MEMCG
Konstantin Khorenko
khorenko at virtuozzo.com
Fri Aug 21 19:42:12 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 bcfa9f11de4857baa7b436491e2d7e3b39d5c0d9
Author: Eva Kurchatova <eva.kurchatova at virtuozzo.com>
Date: Fri Aug 21 18:36:55 2026 +0200
proc: build the per-Container oom_score limit lookup only with CONFIG_MEMCG
proc_oom_score() scales the badness against the memory cgroup limit of
the Container the task belongs to, using memory_cgrp_id,
mem_cgroup_from_css() and mem_cgroup_get_max(). None of those exist with
CONFIG_MEMCG disabled:
fs/proc/base.c: error: 'memory_cgrp_id' undeclared (first use in this
function)
Wrap the whole lookup in CONFIG_MEMCG. totalpages is already initialized
to totalram_pages() + total_swap_pages, so without a memory controller
oom_score simply falls back to being scaled against all of the machine's
memory, which is what a kernel without memory cgroups can report.
Fixes: 708b02c17c36 ("proc,memcg: use memcg limits for showing oom_score inside CT")
Feature: mm/oom: per-CT oom_score virtualization
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/base.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 8174b2a8a5dc4..f7cae1c59ec47 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -692,6 +692,7 @@ static int proc_oom_score(struct seq_file *m, struct pid_namespace *ns,
unsigned long points = 0;
long badness;
+#ifdef CONFIG_MEMCG
scoped_guard (rcu) {
struct cgroup_subsys_state *css = task_css(task, memory_cgrp_id);
@@ -703,6 +704,7 @@ static int proc_oom_score(struct seq_file *m, struct pid_namespace *ns,
totalpages = mem_cgroup_get_max(memcg);
}
}
+#endif
badness = oom_badness(task, totalpages, NULL);
/*
More information about the Devel
mailing list