[Devel] [PATCH RHEL8 COMMIT] oom: Restore vm.oom_relaxation sysctl

Konstantin Khorenko khorenko at virtuozzo.com
Thu Aug 12 13:05:12 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-305.3.1.vz8.7.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-305.3.1.vz8.7.5
------>
commit 224c013bb60350675fb7254962539f47a703cb4c
Author: Evgenii Shatokhin <eshatokhin at virtuozzo.com>
Date:   Thu Aug 12 13:05:12 2021 +0300

    oom: Restore vm.oom_relaxation sysctl
    
    '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"
    Feature: oom: 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,


More information about the Devel mailing list