Your message dated Fri, 27 May 2022 20:35:16 +0200
with message-id <[email protected]>
and subject line Bug#803951 has been solved for a long time
has caused the Debian Bug report #803951,
regarding use oom_score_adj instead of deprecated oom_adj
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
803951: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=803951
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: reniced
Severity: normal
Tags: patch
Hi,
I am not sure where the upstream code sits for this package so I am
reporting it to distribution. Let me know if I should post the patch
somewhere else.
Anyway oom_adj is long deprecated and shouldn't be used. The attached
patch uses oom_score_adj in preference to oom_adj.
-- System Information:
Debian Release: stretch/sid
APT prefers testing
APT policy: (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 4.3.0-rc7 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)
--
Michal Hocko
From: Michal Hocko <[email protected]>
Subject: use oom_score_adj instead of deprecated oom_adj
We are trying to get rid of oom_adj in the kernel. It has been
deprecated since 2.6.36. Let's use oom_score_adj preferably
and fallback to oom_adj when the former is not present (if
used on older systems). As the input expectes only oom_adj
values we have to recalculate it to oom_score_adj scale
(this is taken from fs/proc/base.c:oom_adj_write from the
kernel source tree).
Signed-off-by: Michal Hocko <[email protected]>
Index: reniced-1.19/reniced
===================================================================
--- reniced-1.19.orig/reniced
+++ reniced-1.19/reniced
@@ -415,6 +415,21 @@ sub read_processes()
return \@proc;
}
+sub convert_oom_adj($)
+{
+ my $score = shift;
+ my $OOM_ADJUST_MAX = 15;
+ my $OOM_SCORE_ADJ_MAX = 1000;
+ my $OOM_DISABLE = -17;
+ if ($score == $OOM_ADJUST_MAX) {
+ $score = $OOM_SCORE_ADJ_MAX;
+ } else {
+ $score = int(($score * $OOM_SCORE_ADJ_MAX) / -$OOM_DISABLE);
+ }
+
+ return $score
+}
+
sub renice_processes($$)
# renice
{
@@ -434,16 +449,25 @@ sub renice_processes($$)
# OOM adjust
if (exists $rule->{OOMADJ}) {
- my $procfile = '/proc/'.$proc->{PID}.'/oom_adj';
my $success = 1;
- if ( open (PROC, '>', $procfile) ) {
- print PROC $rule->{OOMADJ}."\n";
- close PROC or $success = 0;
+ my $score = $rule->{OOMADJ};
+
+ my $procfile = '/proc/'.$proc->{PID}.'/oom_score_adj';
+ if ( open (PROC, '>', $procfile)) {
+ $score = convert_oom_adj($score);
} else {
- $success = 0;
+ $procfile = '/proc/'.$proc->{PID}.'/oom_adj';
+ if (! open (PROC, '>', $procfile) ) {
+ $success = 0;
+ }
+ }
+ if ($success) {
+ print $score."\n";
+ print PROC $score."\n";
+ close PROC or $success = 0;
}
debug '%sOOM adjust set to %d: %d/%s'
- , $success ? '' : "FAILED ($!): ", $rule->{OOMADJ}, $proc->{PID}, $proc->{CMD};
+ , $success ? '' : "FAILED ($!): ", $score, $proc->{PID}, $proc->{CMD};
}
# IO nice
--- End Message ---
--- Begin Message ---
Closing this bug as it has been fixed a long time ago:
- on upstream in reniced v1.20 in 2015
- in Debian with reniced 1.21-1 in 2016
--
....Christian.Garbs....................................https://www.cgarbs.de
VEGETARIAN, noun: Indian word meaning "lousy hunter".
--- End Message ---