From fd1e4a384af44a8687b3a5369283f80f1cf29d84 Mon Sep 17 00:00:00 2001 From: Matt Whitlock Date: Sat, 31 Jul 2021 17:41:57 -0400 Subject: add option for OOM score adjustment This commit adds a new --oom-score-adj option to start-stop-daemon and supervise-daemon, as well as an equivalent SSD_OOM_SCORE_ADJ environment variable. If either of these are specified (with the command-line option taking precedence), then the specified adjustment value is written to /proc/self/oom_score_adj after forking but prior to exec'ing the daemon (at the time when nice and ionice are applied). Additionally, per a suggestion by Mike Frysinger, the suggested values for the SSD_NICELEVEL, SSD_IONICELEVEL, and SSD_OOM_SCORE_ADJ variables in the example config file are now given as zeros, which are the kernel's default values of these process knobs for the init process at boot. Note that uncommenting any of these zero-valued suggestions will cause SSD/SD to set the corresponding process knob affirmatively to zero, whereas leaving the variable unset (and the equivalent command- line option unspecified) means SSD/SD will not change the corresponding process knob from its inherited value. See: https://github.com/OpenRC/openrc/pull/435#discussion_r688310672 This fixes #435. --- etc/rc.conf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'etc') diff --git a/etc/rc.conf b/etc/rc.conf index 11e8449a..e93eed59 100644 --- a/etc/rc.conf +++ b/etc/rc.conf @@ -116,10 +116,12 @@ # Some daemons are started and stopped via start-stop-daemon. # We can set some things on a per service basis, like the nicelevel. -#SSD_NICELEVEL="-19" +#SSD_NICELEVEL="0" # Or the ionice level. The format is class[:data] , just like the # --ionice start-stop-daemon parameter. -#SSD_IONICELEVEL="2:2" +#SSD_IONICELEVEL="0:0" +# Or the OOM score adjustment. +#SSD_OOM_SCORE_ADJ="0" # Pass ulimit parameters # If you are using bash in POSIX mode for your shell, note that the -- cgit v1.2.3