[Devel] [PATCH RH8 1/2] oom: Restore vm.oom_relaxation sysctl

Evgenii Shatokhin eshatokhin at virtuozzo.com
Wed Jul 28 20:23:53 MSK 2021


'Berserker mode' is used if the OOM killer has to act too often: if
several tasks are killed within 'oom_relaxation' interval, additional tasks
will be killed.

In VZ7, 'vm.oom_relaxation' sysctl defined that value, but it is missing
in VZ8. Restore it, because the default value (1000 jiffies, 1 sec)
might be too small, for example, for slow or highly loaded machines.

Done in the scope of https://jira.sw.ru/browse/PSBM-131983.

Fixes: 8132f6df9b22 "oom: resurrect berserker mode"
Signed-off-by: Evgenii Shatokhin <eshatokhin at virtuozzo.com>
---
 include/linux/oom.h | 1 +
 kernel/sysctl.c     | 7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/include/linux/oom.h b/include/linux/oom.h
index fbe2ba06fa4b..a3e24891d709 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -148,4 +148,5 @@ extern struct task_struct *find_lock_task_mm(struct task_struct *p);
 extern int sysctl_oom_dump_tasks;
 extern int sysctl_oom_kill_allocating_task;
 extern int sysctl_panic_on_oom;
+extern int sysctl_oom_relaxation;
 #endif /* _INCLUDE_LINUX_OOM_H */
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 82098dccabea..7b20c75d4cf3 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1382,6 +1382,13 @@ static struct ctl_table vm_table[] = {
 		.mode		= 0644,
 		.proc_handler	= proc_dointvec,
 	},
+	{
+		.procname	= "oom_relaxation",
+		.data		= &sysctl_oom_relaxation,
+		.maxlen		= sizeof(sysctl_oom_relaxation),
+		.mode		= 0644,
+		.proc_handler	= proc_dointvec_ms_jiffies,
+	},
 	{
 		.procname	= "overcommit_ratio",
 		.data		= &sysctl_overcommit_ratio,
-- 
2.29.0



More information about the Devel mailing list