diff options
author | B. Watson <urchlay@slackware.uk> | 2024-08-08 01:46:56 -0400 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2024-08-10 08:21:18 +0700 |
commit | de31626eec4060e518beb9ec677437ecb7c390b5 (patch) | |
tree | bbc1448244a49fafb622d4989a266f2280c8c2f3 /system | |
parent | 40c08ff9b56ff8abf9c5ce7d74d21e539ac39221 (diff) | |
download | slackbuilds-de31626eec4060e518beb9ec677437ecb7c390b5.tar.gz slackbuilds-de31626eec4060e518beb9ec677437ecb7c390b5.tar.xz |
system/earlyoom: Updated for version 1.8.2.
Signed-off-by: B. Watson <urchlay@slackware.uk>
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system')
-rw-r--r-- | system/earlyoom/earlyoom.8 | 142 | ||||
-rw-r--r-- | system/earlyoom/earlyoom.SlackBuild | 9 | ||||
-rw-r--r-- | system/earlyoom/earlyoom.info | 6 |
3 files changed, 108 insertions, 49 deletions
diff --git a/system/earlyoom/earlyoom.8 b/system/earlyoom/earlyoom.8 index 9431b55a44..d22f291df9 100644 --- a/system/earlyoom/earlyoom.8 +++ b/system/earlyoom/earlyoom.8 @@ -1,4 +1,20 @@ -.TH "earlyoom" "8" "August 2023" "1.7" "Linux System Administrator's Manual" +.\" Automatically generated by Pandoc 3.1.6 +.\" +.\" 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" "8" "August 2024" "1.8.2" "Linux System Administrator\[cq]s Manual" .hy .SH NAME .PP @@ -15,19 +31,32 @@ 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[C]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[V]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] .PP -set available memory minimum to PERCENT of total (default 10 %). +set available memory minimum to PERCENT of \f[V]user mem total\f[R] +(default 10 %). +.PP +\f[V]user mem total\f[R], introduced in earlyoom v1.8, is the memory +accessible by userspace (\f[V]MemAvailable\f[R]+\f[V]AnonPages\f[R] as +reported in \f[V]/proc/meminfo\f[R]). +When a tmpfs ramdisk fills up, \f[V]user mem total\f[R] shrinks +accordingly. +.PP +By using a percentage of \f[V]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 @@ -49,7 +78,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 @@ -58,9 +87,14 @@ 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. -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. +\f[V]-M\f[R] sets the available memory minimum to SIZE KiB. +The value is internally converted to the percentage of +\f[V]mem total\f[R] as reported on startup. +\f[V]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[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 @@ -73,10 +107,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. @@ -86,7 +120,7 @@ removed in earlyoom v1.2, ignored for compatibility .SS -i .PP removed in earlyoom v1.7, ignored for compatibility -.SS -d +.SS -d, \[en]debug .PP enable debugging messages .SS -v @@ -114,19 +148,6 @@ actual interval may be up to 1 second longer than the setting. .PP 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. -To achieve the same effect, enter the following three lines into -\f[C]sudo systemctl edit earlyoom\f[R]: -.IP -.nf -\f[C] -[Service] -OOMScoreAdjust=-100 -Nice=-20 -\f[R] -.fi .SS -n .PP Enable notifications via d-bus. @@ -146,11 +167,12 @@ via the following environment variables: \f[C] 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 .PP -WARNING: \f[C]EARLYOOM_NAME\f[R] can contain spaces, newlines, special +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 @@ -167,8 +189,8 @@ 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[C]gnome-shell\f[R]. -earlyoom might kill all such processes including \f[C]gnome-shell\f[R] +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. @@ -183,13 +205,32 @@ pstree -gT to show all processes with the PGID in brackets. .SS --prefer REGEX .PP -prefer killing processes matching REGEX (adds 300 to oom_score) +Prefer killing processes whose \f[V]comm\f[R] name matches REGEX (adds +300 to oom_score). +.PP +The \f[V]comm\f[R] name is the string in \f[V]/proc/pid/comm\f[R]. +It is the first 15 bytes of the process name. +Longer names are truncated to 15 bytes. +.PP +The \f[V]comm\f[R] name is also what \f[V]top\f[R], \f[V]pstree\f[R], +\f[V]ps -e\f[R] show. +Use any of these tools to find the proper \f[V]comm\f[R] name. +.PP +Example: You want to match \f[V]gnome-control-center\f[R], which is +longer than 15 bytes: +.IP +.nf +\f[C] +earlyoom --prefer \[aq]\[ha]gnome-control-c$\[aq] +\f[R] +.fi .SS --avoid REGEX .PP -avoid killing processes matching REGEX (subtracts 300 from oom_score) +avoid killing processes whose \f[V]comm\f[R] name matches REGEX +(subtracts 300 from oom_score). .SS --ignore REGEX .PP -ignore processes matching REGEX. +ignore processes whose \f[V]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 @@ -198,9 +239,20 @@ attaining a high oom_score. 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 +.PP +find process with the largest rss (default oom_score) .SS --dryrun .PP dry run (do not kill any processes) +.SS --syslog +.PP +use syslog instead of std streams. +.PP +The --syslog option may be useful for systems that don\[cq]t run +systemd. +See https://github.com/rfjakob/earlyoom/pull/292 for some background +info. .SS -h, --help .PP this help text @@ -235,11 +287,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 +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[C]oom_score_adj\f[R] very high. +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 @@ -253,18 +305,20 @@ 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 -The author of earlyoom is Jakob Unterwurzacher -<jakobunt@gmail.com>. +The author of earlyoom is Jakob Unterwurzacher <jakobunt@gmail.com>. +.PP +This manual page was written by Yangfl <mmyangfl@gmail.com>, for the +Debian project (and may be used by others). +.SH SEE ALSO .PP -This manual page was written by Yangfl <mmyangfl@gmail.com>, -for the Debian project (and may be used by others). +nohang(8) diff --git a/system/earlyoom/earlyoom.SlackBuild b/system/earlyoom/earlyoom.SlackBuild index 9a04c78429..442c8c8abb 100644 --- a/system/earlyoom/earlyoom.SlackBuild +++ b/system/earlyoom/earlyoom.SlackBuild @@ -23,6 +23,7 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# 20240807 bkw: update for v1.8.2. # 20230829 bkw: BUILD=2 # - add LICENSE and README.md to the doc dir. # - binary in /usr/sbin, man page in section 8, since this is admin stuff. @@ -34,8 +35,8 @@ cd $(dirname $0) ; CWD=$(pwd) PRGNAM=earlyoom -VERSION=${VERSION:-1.7} -BUILD=${BUILD:-2} +VERSION=${VERSION:-1.8.2} +BUILD=${BUILD:-1} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} @@ -85,6 +86,10 @@ sed -i '/^PANDOC *:=/d' Makefile # 20230829 bkw: no way to do this on the make command line: sed -i "/^CFLAGS/s,-Wall,& $SLKCFLAGS," Makefile +# 20240808 bkw: fix path to rc file (and remove systemd mention) in +# comments in the /etc/default file. +sed -i 's,/etc/init.d/.*,/etc/rc.d/rc.earlyoom,' earlyoom.default + # 20230829 bkw: note to self: non-canonical use of BINDIR here. It's not # the full path (/usr/sbin), it gets PREFIX prepended to it. make PREFIX=/usr BINDIR=/sbin diff --git a/system/earlyoom/earlyoom.info b/system/earlyoom/earlyoom.info index bb2d219617..7dd7697d8f 100644 --- a/system/earlyoom/earlyoom.info +++ b/system/earlyoom/earlyoom.info @@ -1,8 +1,8 @@ PRGNAM="earlyoom" -VERSION="1.7" +VERSION="1.8.2" HOMEPAGE="https://github.com/rfjakob/earlyoom" -DOWNLOAD="https://github.com/rfjakob/earlyoom/archive/v1.7/earlyoom-1.7.tar.gz" -MD5SUM="9c567930c60b2ccdc536951b005d413d" +DOWNLOAD="https://github.com/rfjakob/earlyoom/archive/v1.8.2/earlyoom-1.8.2.tar.gz" +MD5SUM="efe012c5e345a367132337ab102d0f6f" DOWNLOAD_x86_64="" MD5SUM_x86_64="" REQUIRES="" |