diff --git a/earlyoom-1.7.tar.gz b/earlyoom-1.7.tar.gz new file mode 100644 index 0000000..bfc0689 --- /dev/null +++ b/earlyoom-1.7.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ebda1279a813d9b0f7860ce5029ccf5ea9f8868be070f2eaf40f90f2e64b6414 +size 52210 diff --git a/earlyoom.1 b/earlyoom.1 index 67978f7..ba4237f 100644 --- a/earlyoom.1 +++ b/earlyoom.1 @@ -1,5 +1,19 @@ -.\" Automatically generated by Pandoc 2.13 +.\" Automatically generated by Pandoc 2.17.1.1 .\" +.\" 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 @@ -18,7 +32,7 @@ back to what one was doing after running out of patience. \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[C]oom_score\f[R]). +the largest process (highest \f[V]oom_score\f[R]). The percentage value is configurable via command line arguments. .PP If there is a failure when trying to kill a process, \f[B]earlyoom\f[R] @@ -51,7 +65,7 @@ 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[C]-s 100\f[R] to have earlyoom effectively ignore swap +You can use \f[V]-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 @@ -60,9 +74,9 @@ use SIGKILL. .SS -M SIZE[,KILL_SIZE] .PP As an alternative to specifying a percentage of total memory, -\f[C]-M\f[R] sets the available memory minimum to SIZE KiB. +\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[C]-M\f[R] and \f[C]-m\f[R], the lower value is used. +If you pass both \f[V]-M\f[R] and \f[V]-m\f[R], the lower value is used. Example: Reserve 10% of RAM but at most 1 GiB: .IP .nf @@ -75,10 +89,10 @@ 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[C]-S\f[R] +As an alternative to specifying a percentage of total swap, \f[V]-S\f[R] sets the free swap minimum to SIZE KiB. The value is internally converted to a percentage. -If you pass both \f[C]-S\f[R] and \f[C]-s\f[R], the lower value is used. +If you pass both \f[V]-S\f[R] and \f[V]-s\f[R], the lower value is used. .PP Send SIGKILL if at or below KILL_SIZE (default SIZE/2), otherwise SIGTERM. @@ -87,7 +101,7 @@ SIGTERM. removed in earlyoom v1.2, ignored for compatibility .SS -i .PP -user-space oom killer should ignore positive oom_score_adj values +removed in earlyoom v1.7, ignored for compatibility .SS -d .PP enable debugging messages @@ -118,9 +132,9 @@ 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[C]-p\f[R] switch doesn\[cq]t work. +\f[V]-p\f[R] switch doesn\[cq]t work. To achieve the same effect, enter the following three lines into -\f[C]sudo systemctl edit earlyoom\f[R]: +\f[V]sudo systemctl edit earlyoom\f[R]: .IP .nf \f[C] @@ -132,6 +146,57 @@ Nice=-20 .SS -n .PP 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 +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] +EARLYOOM_PID Process PID +EARLYOOM_NAME Process name truncated to 16 bytes (as reported in /proc/PID/comm) +EARLYOOM_UID UID of the user running the process +\f[R] +.fi +.PP +WARNING: \f[V]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 +Kill all processes that have same process group id (PGID) as the process +with excessive memory usage. +.PP +For example, with this flag turned on, the whole application will be +killed when one of its subprocess consumes too much memory (as long as +they all have the same PGID, of course). +.PP +Enable this flag when completely cleaning up the \[lq]entire +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] +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 +.PP +to show all processes with the PGID in brackets. .SS --prefer REGEX .PP prefer killing processes matching REGEX (adds 300 to oom_score) @@ -175,11 +240,11 @@ this help text 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[C]echo f > /proc/sysrq-trigger\f[R] because the -Chrome people made their browser always be the first (innocent!) victim -by setting \f[C]oom_score_adj\f[R] very high. +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. Instead, earlyoom finds out itself by reading through -\f[C]/proc/*/status\f[R] (actually \f[C]/proc/*/statm\f[R], which +\f[V]/proc/*/status\f[R] (actually \f[V]/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 @@ -193,13 +258,13 @@ 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[C]-S\f[R] +If there is zero total swap on earlyoom startup, any \f[V]-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[C]--prefer\f[R], negative -\f[C]oom_score_adj\f[R] values are not taken into account, and the -process gets an effective \f[C]oom_score\f[R] of at least 300. +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. See https://github.com/rfjakob/earlyoom/issues/159 for details. .SH AUTHOR .PP diff --git a/earlyoom.changes b/earlyoom.changes index 72884be..517b5ee 100644 --- a/earlyoom.changes +++ b/earlyoom.changes @@ -1,3 +1,18 @@ +------------------------------------------------------------------- +Sun Mar 6 23:05:48 UTC 2022 - Илья Индиго + +- Refreshed spec-file via spec-cleaner and manual optimizated. + * Reduced to the standard github URL. + * 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). + * 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. + * Removed -i flag, it does not work properly on Linux kernels 5.9+. + * Droped ambient capabilities on startup. + ------------------------------------------------------------------- Thu Nov 18 09:31:29 UTC 2021 - Илья Индиго diff --git a/earlyoom.spec b/earlyoom.spec index 318ab49..acbdc8b 100644 --- a/earlyoom.spec +++ b/earlyoom.spec @@ -1,7 +1,7 @@ # # spec file for package earlyoom # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -22,16 +22,16 @@ %global _fillupdir %{_localstatedir}/adm/fillup-templates %endif Name: earlyoom -Version: 1.6.2 +Version: 1.7 Release: 0 Summary: Early OOM Daemon for Linux License: MIT Group: System/Daemons URL: https://github.com/rfjakob/%{name} -Source0: %{URL}/archive/v%{version}.tar.gz -Source11: %{name}.sysconfig +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 -Source12: earlyoom.1 +Source2: earlyoom.1 BuildRequires: pkgconfig BuildRequires: pkgconfig(systemd) Conflicts: oomd @@ -44,11 +44,11 @@ earlyoom checks the amount of available memory and free swap, and if both are below critical level, it will kill the largest process (highest oom_score). %prep -%autosetup +%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 %{SOURCE12} -nt README.md +test %{SOURCE2} -nt README.md # Fix defaults file location sed -i 's|/default/|/sysconfig/|' earlyoom.service.in @@ -74,12 +74,11 @@ LDFLAGS="-lrt ${RPM_LD_FLAGS}" %install %make_install PREFIX=%{_prefix} SYSTEMDUNITDIR=%{_unitdir} -install -D -m644 %{SOURCE11} %{buildroot}%{_fillupdir}/sysconfig.%{name} -install -d %{buildroot}%{_mandir}/man1/ -install -m644 %{SOURCE12} %{buildroot}%{_mandir}/man1/ +install -Dpm0644 %{SOURCE1} %{buildroot}%{_fillupdir}/sysconfig.%{name} +install -Dpm0644 %{SOURCE2} %{buildroot}%{_mandir}/man1/%{name}.1 mkdir -p %{buildroot}%{_sbindir} -ln -sf service %{buildroot}%{_sbindir}/rc%{name} +ln -s service %{buildroot}%{_sbindir}/rc%{name} %files %license LICENSE @@ -89,6 +88,7 @@ ln -sf service %{buildroot}%{_sbindir}/rc%{name} %exclude %{_sysconfdir}/default/%{name} %{_fillupdir}/sysconfig.%{name} %{_sbindir}/rc%{name} +%dir %{_mandir}/man1 %{_mandir}/man1/%{name}.1%{?ext_man} %pre diff --git a/earlyoom.sysconfig b/earlyoom.sysconfig index 2e83e6d..19f9377 100644 --- a/earlyoom.sysconfig +++ b/earlyoom.sysconfig @@ -2,11 +2,11 @@ ## Description: configuration for Early OOM Daemon ## Type: string -## Default: "-r 3 -m 6 -s 10 -n -p --avoid '(^|/)(systemd|Xorg|X|Xwayland|xdm|sddm|kdm|gdm|lightdm|plasmashell|kwin_wayland|kwin_x11|ssh|yast|yast2|y2controlcenter|zypper|rpm)$' --prefer '(^|/)(java|Web\ Content|GeckoMain|chrome|opera|ffmpeg|vlc|akregator|thumbnail.so)$'" +## Default: "-r 3 -m 6 -s 10 -n -p --avoid '(^|/)(systemd|Xorg|X|Xwayland|xdm|sddm|kdm|gdm|lightdm|plasmashell|kwin_wayland|kwin_x11|ssh|yast|yast2|y2controlcenter|zypper|rpm)$' --prefer '(^|/)(java|Isolated\ Web\ Co|Web\ Content|WebExtensions|firefox|chrome|opera|ffmpeg|vlc|akregator|thumbnail.so)$'" ## Config: earlyoom # # Command-line options to pass to earlyoom # # see man(1) earlyoom # -EARLYOOM_ARGS="-r 0 -m 6 -s 10 -n -p --avoid '(^|/)(systemd|Xorg|X|Xwayland|xdm|sddm|kdm|gdm|lightdm|plasmashell|kwin_wayland|kwin_x11|ssh|yast|yast2|y2controlcenter|zypper|rpm|dnf)$' --prefer '(^|/)(java|Web\ Content|GeckoMain|chrome|opera|falkon|ffmpeg|vlc|mpv|akregator|thumbnail.so)$'" +EARLYOOM_ARGS="-r 0 -m 6 -s 10 -n -p --avoid '(^|/)(systemd|Xorg|X|Xwayland|xdm|sddm|kdm|gdm|lightdm|plasmashell|kwin_wayland|kwin_x11|ssh|yast|yast2|y2controlcenter|zypper|rpm|dnf)$' --prefer '(^|/)(java|Isolated\ Web\ Co|Web\ Content|WebExtensions|firefox|chrome|opera|falkon|ffmpeg|vlc|mpv|akregator|thumbnail.so)$'" diff --git a/v1.6.2.tar.gz b/v1.6.2.tar.gz deleted file mode 100644 index 3e3bd46..0000000 --- a/v1.6.2.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:227234cf9e77831c21c748bd361e1a7c415e158b96034eacd59e70586779bb6c -size 49006