Accepting request 1167928 from home:13ilya:branches:Base:System

- Updated to 1.8
  * Changed file earlyoom.1 (MANPAGE.md -s -t man > earlyoom.1).
  * https://github.com/rfjakob/earlyoom#changelog  
  * Introduce user mem total / meminfo_t.UserMemTotal and
    calculate MemAvailablePercent.
  * Added NO_COLOR support.
  * Fixed handling of processes with a zombie main thread.
  * Added --sort-by-rss. This will select a process to kill acc
    to the largest RSS instead of largest oom_score.

OBS-URL: https://build.opensuse.org/request/show/1167928
OBS-URL: https://build.opensuse.org/package/show/Base:System/earlyoom?expand=0&rev=39
This commit is contained in:
Илья Индиго 2024-04-16 06:41:35 +00:00 committed by Git OBS Bridge
parent 0979e8cdd5
commit f58657282a
5 changed files with 158 additions and 135 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ebda1279a813d9b0f7860ce5029ccf5ea9f8868be070f2eaf40f90f2e64b6414
size 52210

3
earlyoom-1.8.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bbb050a2294e60dafc0b129fcec705ef95d9d27f4c9dae1d3b4f25e4f698ae41
size 61345

View File

@ -1,49 +1,43 @@
.\" Automatically generated by Pandoc 2.17.1.1
.\" Automatically generated by Pandoc 3.1.12.3
.\"
.\" Define V font for inline verbatim, using C font in formats
.\" that render this, and otherwise B font.
.ie "\f[CB]x\f[]"x" \{\
. ftr V B
. ftr VI BI
. ftr VB B
. ftr VBI BI
.\}
.el \{\
. ftr V CR
. ftr VI CI
. ftr VB CB
. ftr VBI CBI
.\}
.TH "earlyoom" "1" "" "" "General Commands Manual"
.hy
.SH NAME
.PP
earlyoom - Early OOM Daemon
earlyoom \- Early OOM Daemon
.SH SYNOPSIS
.PP
\f[B]earlyoom\f[R] [\f[B]OPTION\f[R]]\&...
.SH DESCRIPTION
.PP
The oom-killer generally has a bad reputation among Linux users.
The oom\-killer generally has a bad reputation among Linux users.
One may have to sit in front of an unresponsive system, listening to the
grinding disk for minutes, and press the reset button to quickly get
back to what one was doing after running out of patience.
.PP
\f[B]earlyoom\f[R] checks the amount of available memory and free swap
up to 10 times a second (less often if there is a lot of free memory).
If \f[B]both\f[R] memory \f[B]and\f[R] swap are below 10%, it will kill
the largest process (highest \f[V]oom_score\f[R]).
The percentage value is configurable via command line arguments.
If \f[B]both\f[R] memory \f[B]and\f[R] swap (if any) are below 10%, it
will kill the largest process (highest \f[CR]oom_score\f[R]).
.PP
The percentage values are configurable via command line arguments.
.PP
If there is a failure when trying to kill a process, \f[B]earlyoom\f[R]
sleeps for 1 second to limit log spam due to recurring errors.
.SH OPTIONS
.SS -m PERCENT[,KILL_PERCENT]
.SS \-m PERCENT[,KILL_PERCENT]
set available memory minimum to PERCENT of \f[CR]user mem total\f[R]
(default 10 %).
.PP
set available memory minimum to PERCENT of total (default 10 %).
\f[CR]user mem total\f[R], introduced in earlyoom v1.8, is the memory
accessible by userspace (\f[CR]MemAvailable\f[R]+\f[CR]AnonPages\f[R] as
reported in \f[CR]/proc/meminfo\f[R]).
When a tmpfs ramdisk fills up, \f[CR]user mem total\f[R] shrinks
accordingly.
.PP
By using a percentage of \f[CR]user mem total\f[R] as opposed to total
memory, the set memory minimum can always be achieved by killing
processes, even when tmpfs fills a large portion of memory.
.PP
earlyoom sends SIGTERM once \f[B]both\f[R] available memory
\f[B]and\f[R] free swap are below their respective PERCENT settings.
.PP
earlyoom starts sending SIGTERM once \f[B]both\f[R] memory \f[B]and\f[R]
swap are below their respective PERCENT setting.
It sends SIGKILL once \f[B]both\f[R] are below their respective
KILL_PERCENT setting (default PERCENT/2).
.PP
@ -52,125 +46,114 @@ use SIGKILL.
.PP
Examples:
.IP
.nf
\f[C]
.EX
earlyoom # sets PERCENT=10, KILL_PERCENT=5
earlyoom -m 30 # sets PERCENT=30, KILL_PERCENT=15
earlyoom -m 20,18 # sets PERCENT=20, KILL_PERCENT=18
\f[R]
.fi
.SS -s PERCENT[,KILL_PERCENT]
.PP
earlyoom \-m 30 # sets PERCENT=30, KILL_PERCENT=15
earlyoom \-m 20,18 # sets PERCENT=20, KILL_PERCENT=18
.EE
.SS \-s PERCENT[,KILL_PERCENT]
set free swap minimum to PERCENT of total (default 10 %).
Send SIGKILL if at or below KILL_PERCENT (default PERCENT/2), otherwise
SIGTERM.
.PP
You can use \f[V]-s 100\f[R] to have earlyoom effectively ignore swap
You can use \f[CR]\-s 100\f[R] to have earlyoom effectively ignore swap
usage: Processes are killed once available memory drops below the
configured minimum, no matter how much swap is free.
.PP
Use the same value for PERCENT and KILL_PERCENT if you always want to
use SIGKILL.
.SS -M SIZE[,KILL_SIZE]
.PP
.SS \-M SIZE[,KILL_SIZE]
As an alternative to specifying a percentage of total memory,
\f[V]-M\f[R] sets the available memory minimum to SIZE KiB.
The value is internally converted to a percentage.
If you pass both \f[V]-M\f[R] and \f[V]-m\f[R], the lower value is used.
\f[CR]\-M\f[R] sets the available memory minimum to SIZE KiB.
The value is internally converted to the percentage of
\f[CR]mem total\f[R] as reported on startup.
\f[CR]user mem total\f[R] is NOT used for the startup calculation
because that would make the outcome dependent on how filled tmpfs is at
that moment.
.PP
If you pass both \f[CR]\-M\f[R] and \f[CR]\-m\f[R], the lower value is
used.
Example: Reserve 10% of RAM but at most 1 GiB:
.IP
.nf
\f[C]
earlyoom -m 10 -M 1048576
\f[R]
.fi
.EX
earlyoom \-m 10 \-M 1048576
.EE
.PP
earlyoom sends SIGKILL if at or below KILL_SIZE (default SIZE/2),
otherwise SIGTERM.
.SS -S SIZE[,KILL_SIZE]
.PP
As an alternative to specifying a percentage of total swap, \f[V]-S\f[R]
sets the free swap minimum to SIZE KiB.
.SS \-S SIZE[,KILL_SIZE]
As an alternative to specifying a percentage of total swap,
\f[CR]\-S\f[R] sets the free swap minimum to SIZE KiB.
The value is internally converted to a percentage.
If you pass both \f[V]-S\f[R] and \f[V]-s\f[R], the lower value is used.
If you pass both \f[CR]\-S\f[R] and \f[CR]\-s\f[R], the lower value is
used.
.PP
Send SIGKILL if at or below KILL_SIZE (default SIZE/2), otherwise
SIGTERM.
.SS -k
.PP
.SS \-k
removed in earlyoom v1.2, ignored for compatibility
.SS -i
.PP
.SS \-i
removed in earlyoom v1.7, ignored for compatibility
.SS -d
.PP
.SS \-d, \[en]debug
enable debugging messages
.SS -v
.PP
.SS \-v
print version information and exit
.SS -r INTERVAL
.PP
.SS \-r INTERVAL
Time between printing periodic memory reports, in seconds (default 1.0).
A memory report looks like this:
.IP
.nf
\f[C]
.EX
mem avail: 21790 of 23909 MiB (91.14%), swap free: 0 of 0 MiB ( 0.00%)
\f[R]
.fi
.EE
.PP
Set to 3600 to print a report every hour, to 86400 to print once a day
etc.
Set to 0 to disable printing periodic memory reports.
Free memory monitoring and low-memory killing runs independently of this
option at an adaptive poll rate that only depends on free memory.
Free memory monitoring and low\-memory killing runs independently of
this option at an adaptive poll rate that only depends on free memory.
Due to the adaptive poll rate, when there is a lot of free memory, the
actual interval may be up to 1 second longer than the setting.
.SS -p
.PP
Increase earlyoom\[cq]s priority: set niceness of earlyoom to -20 and
oom_score_adj to -100.
.SS \-p
Increase earlyoom\[cq]s priority: set niceness of earlyoom to \-20 and
oom_score_adj to \-100.
.PP
When earlyoom is run through its default systemd service, the
\f[V]-p\f[R] switch doesn\[cq]t work.
\f[CR]\-p\f[R] switch doesn\[cq]t work.
To achieve the same effect, enter the following three lines into
\f[V]sudo systemctl edit earlyoom\f[R]:
\f[CR]sudo systemctl edit earlyoom\f[R]:
.IP
.nf
\f[C]
.EX
[Service]
OOMScoreAdjust=-100
Nice=-20
\f[R]
.fi
.SS -n
.PP
Enable notifications via d-bus.
OOMScoreAdjust=\-100
Nice=\-20
.EE
.SS \-n
Enable notifications via d\-bus.
.PP
To actually see the notifications in your GUI session, you need to have
systembus-notify (https://github.com/rfjakob/systembus-notify) running
as your user.
.SS -N /PATH/TO/SCRIPT
.PP
\c
.UR https://github.com/rfjakob/systembus-notify
systembus\-notify
.UE \c
\ running as your user.
.SS \-N /PATH/TO/SCRIPT
Run the given script for each process killed.
Must be an absolute path.
.PP
Within the script, information about the killed process can be obtained
via the following environment variables:
.IP
.nf
\f[C]
.EX
EARLYOOM_PID Process PID
EARLYOOM_NAME Process name truncated to 16 bytes (as reported in /proc/PID/comm)
EARLYOOM_CMDLINE Process cmdline truncated to 256 bytes (as reported in /proc/PID/cmdline)
EARLYOOM_UID UID of the user running the process
\f[R]
.fi
.EE
.PP
WARNING: \f[V]EARLYOOM_NAME\f[R] can contain spaces, newlines, special
WARNING: \f[CR]EARLYOOM_NAME\f[R] can contain spaces, newlines, special
characters and is controlled by the user, or it can be empty!
Make sure that your notification script can handle that!
.SS -g
.PP
.SS \-g
Kill all processes that have same process group id (PGID) as the process
with excessive memory usage.
.PP
@ -183,37 +166,68 @@ application\[rq] is more desirable, and you are sure that the
application puts all its processes in the same PGID.
.PP
Note that some desktop environments (GNOME, for example) put all desktop
application in the same process group as \f[V]gnome-shell\f[R].
earlyoom might kill all such processes including \f[V]gnome-shell\f[R]
application in the same process group as \f[CR]gnome\-shell\f[R].
earlyoom might kill all such processes including \f[CR]gnome\-shell\f[R]
when this flag is turned on.
.PP
Be sure to check how your environment behaves beforehand.
Use
.IP
.nf
\f[C]
pstree -gT
\f[R]
.fi
.EX
pstree \-gT
.EE
.PP
to show all processes with the PGID in brackets.
.SS --prefer REGEX
.SS \-\-prefer REGEX
Prefer killing processes whose \f[CR]comm\f[R] name matches REGEX (adds
300 to oom_score).
.PP
prefer killing processes matching REGEX (adds 300 to oom_score)
.SS --avoid REGEX
The \f[CR]comm\f[R] name is the string in \f[CR]/proc/pid/comm\f[R].
It is the first 15 bytes of the process name.
Longer names are truncated to 15 bytes.
.PP
avoid killing processes matching REGEX (subtracts 300 from oom_score)
.SS --dryrun
The \f[CR]comm\f[R] name is also what \f[CR]top\f[R], \f[CR]pstree\f[R],
\f[CR]ps \-e\f[R] show.
Use any of these tools to find the proper \f[CR]comm\f[R] name.
.PP
Example: You want to match \f[CR]gnome\-control\-center\f[R], which is
longer than 15 bytes:
.IP
.EX
earlyoom \-\-prefer \[aq]\[ha]gnome\-control\-c$\[aq]
.EE
.SS \-\-avoid REGEX
avoid killing processes whose \f[CR]comm\f[R] name matches REGEX
(subtracts 300 from oom_score).
.SS \-\-ignore REGEX
ignore processes whose \f[CR]comm\f[R] name matches REGEX.
.PP
Unlike the \-\-avoid option, this option disables any potential killing
of the matched processes that might have occurred due to the processes
attaining a high oom_score.
.PP
Use this option with caution as other processes might be sacrificed in
place of the ignored processes when earlyoom determines to kill
processes.
.SS \-\-sort\-by\-rss
find process with the largest rss (default oom_score)
.SS \-\-dryrun
dry run (do not kill any processes)
.SS -h, --help
.SS \-\-syslog
use syslog instead of std streams.
.PP
Usually this is not needed as systemd handles logging of all output.
.PP
The \-\-syslog option may be useful for minimal embedded systems that
don\[cq]t run systemd.
See https://github.com/rfjakob/earlyoom/pull/292 for some background
info.
.SS \-h, \-\-help
this help text
.SH EXIT STATUS
.PP
0: Successful program execution.
.PP
1: Other error - inspect message for details
1: Other error \- inspect message for details
.PP
2: Switch conflict.
.PP
@ -221,7 +235,7 @@ this help text
.PP
5: Could not open proc
.PP
7: Could not open /proc/sysrq-trigger
7: Could not open /proc/sysrq\-trigger
.PP
13: Unknown options.
.PP
@ -239,12 +253,11 @@ this help text
.PP
105: Could not convert number when parse the contents of /proc/meminfo
.SH Why not trigger the kernel oom killer?
.PP
Earlyoom does not use \f[V]echo f > /proc/sysrq-trigger\f[R] because the
Chrome people made their browser always be the first (innocent!)
victim by setting \f[V]oom_score_adj\f[R] very high.
Earlyoom does not use \f[CR]echo f > /proc/sysrq\-trigger\f[R] because
the Chrome people made their browser always be the first (innocent!)
victim by setting \f[CR]oom_score_adj\f[R] very high.
Instead, earlyoom finds out itself by reading through
\f[V]/proc/*/status\f[R] (actually \f[V]/proc/*/statm\f[R], which
\f[CR]/proc/*/status\f[R] (actually \f[CR]/proc/*/statm\f[R], which
contains the same information but is easier to parse programmatically).
.PP
Additionally, in recent kernels (tested on 4.0.5), triggering the kernel
@ -252,24 +265,22 @@ oom killer manually may not work at all.
That is, it may only free some graphics memory (that will be allocated
immediately again) and not actually kill any process.
.SH MEMORY USAGE
.PP
About 2 MiB VmRSS.
All memory is locked using mlockall() to make sure earlyoom does not
slow down in low memory situations.
.SH BUGS
.PP
If there is zero total swap on earlyoom startup, any \f[V]-S\f[R]
If there is zero total swap on earlyoom startup, any \f[CR]\-S\f[R]
(uppercase \[lq]S\[rq]) values are ignored, a warning is printed, and
default swap percentages are used.
.PP
For processes matched by \f[V]--prefer\f[R], negative
\f[V]oom_score_adj\f[R] values are not taken into account, and the
process gets an effective \f[V]oom_score\f[R] of at least 300.
For processes matched by \f[CR]\-\-prefer\f[R], negative
\f[CR]oom_score_adj\f[R] values are not taken into account, and the
process gets an effective \f[CR]oom_score\f[R] of at least 300.
See https://github.com/rfjakob/earlyoom/issues/159 for details.
.SH AUTHOR
The author of earlyoom is Jakob Unterwurzacher ⟨jakobunt\[at]gmail.com⟩.
.PP
The author of earlyoom is Jakob Unterwurzacher
\[la]jakobunt\[at]gmail.com\[ra].
.PP
This manual page was written by Yangfl \[la]mmyangfl\[at]gmail.com\[ra],
for the Debian project (and may be used by others).
This manual page was written by Yangfl ⟨mmyangfl\[at]gmail.com⟩, for the
Debian project (and may be used by others).
.SH SEE ALSO
nohang(8)

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Tue Apr 16 06:31:41 UTC 2024 - Илья Индиго <13ilya@gmail.com>
- Updated to 1.8
* Changed file earlyoom.1 (MANPAGE.md -s -t man > earlyoom.1).
* https://github.com/rfjakob/earlyoom#changelog
* Introduce user mem total / meminfo_t.UserMemTotal and
calculate MemAvailablePercent.
* Added NO_COLOR support.
* Fixed handling of processes with a zombie main thread.
* Added --sort-by-rss. This will select a process to kill acc
to the largest RSS instead of largest oom_score.
-------------------------------------------------------------------
Wed May 18 16:14:43 UTC 2022 - Илья Индиго <ilya@ilya.cf>
@ -6,7 +19,7 @@ Wed May 18 16:14:43 UTC 2022 - Илья Индиго <ilya@ilya.cf>
* Added -p flag to all install commands.
- Updated file earlyoom.sysconfig with actual firefox process names.
- Updated to 1.7
* Updated file earlyoom.1 (MANPAGE.md -s -t man > earlyoom.1).
* Changed file earlyoom.1 (MANPAGE.md -s -t man > earlyoom.1).
* https://github.com/rfjakob/earlyoom#changelog
* Added -N flag to run a script every time a process is killed.
* Added -g flag to kill whole process group.

View File

@ -1,7 +1,7 @@
#
# spec file for package earlyoom
#
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -22,7 +22,7 @@
%global _fillupdir %{_localstatedir}/adm/fillup-templates
%endif
Name: earlyoom
Version: 1.7
Version: 1.8
Release: 0
Summary: Early OOM Daemon for Linux
License: MIT
@ -31,6 +31,7 @@ URL: https://github.com/rfjakob/%{name}
Source0: https://github.com/rfjakob/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: %{name}.sysconfig
# Inject pre-build earlyoom.1, built on x86_64 machine, as pandoc does not exist on all archs
# pandoc MANPAGE.md -s -t man > earlyoom.1
Source2: earlyoom.1
BuildRequires: pkgconfig
BuildRequires: pkgconfig(systemd)
@ -45,9 +46,7 @@ below critical level, it will kill the largest process (highest oom_score).
%prep
%autosetup -p1
# Test if our pre-build earloom.1 is newer than README.md; if not, fail
# in case of fail, rebuild the earlyoom.1 out of the build system using
# pandoc MANPAGE.md -s -t man > earlyoom.1
# Test if our pre-build earloom.1 is newer than README.md; if not, fail.
test %{SOURCE2} -nt README.md
# Fix defaults file location