[Devel] [PATCH RHEL10 COMMIT] mm/oom: build the berserker mode only with CONFIG_MEMCG
Konstantin Khorenko
khorenko at virtuozzo.com
Fri Aug 21 19:42:11 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 15359d8092f220b53802e9a86de7cf10b8acff1a
Author: Eva Kurchatova <eva.kurchatova at virtuozzo.com>
Date: Fri Aug 21 18:36:54 2026 +0200
mm/oom: build the berserker mode only with CONFIG_MEMCG
oom_berserker() works on the memory cgroup the OOM happened in: it takes
memcg->oom_rage_lock, updates memcg->oom_time/oom_rage, falls back to
root_mem_cgroup and calls task_in_mem_cgroup(). None of that exists when
CONFIG_MEMCG is disabled:
mm/oom_kill.c: error: 'root_mem_cgroup' undeclared
mm/oom_kill.c: error: invalid use of undefined type 'struct mem_cgroup'
Compile the function only when CONFIG_MEMCG is enabled and provide an
empty stub otherwise: without a memory controller there is no per-cgroup
OOM rate to get enraged about, and the caller stays unchanged.
Fixes: 6517e9ae0449 ("oom: resurrect berserker mode")
Feature: mm/oom: berserker mode
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/oom_kill.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 1fd5f99ce3b92..5cf0fefade481 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -1047,6 +1047,7 @@ static int oom_kill_memcg_member(struct task_struct *task, void *message)
/*
* Kill more processes if oom happens too often in this context.
*/
+#ifdef CONFIG_MEMCG
static void oom_berserker(struct oom_control *oc)
{
static DEFINE_RATELIMIT_STATE(berserker_rs,
@@ -1150,6 +1151,9 @@ static void oom_berserker(struct oom_control *oc)
pr_err("OOM killer in rage %d: %d tasks killed\n", rage, killed);
}
+#else
+static inline void oom_berserker(struct oom_control *oc) { }
+#endif /* CONFIG_MEMCG */
atomic_t global_oom = ATOMIC_INIT(0);
More information about the Devel
mailing list