I'd like ask for adding new feature to openrc, allowing adjusting score for OOM Killer. Something like "rc_oom_adj=1234" in /etc/conf.d/bar-foo file. Those value should be passed to: /proc/<pid>/oom_score_adj It could allow sysadmin to choose which services are more (or less) important in extreme situation. Reproducible: Always
Wouldn't you rather set that in </etc/sysctl.conf> or </etc/sysctl.d/foo-bar>? sys-apps/openrc already has an init.d script that runs sysctl (</etc/init.d/sysctl>).
we're not going to add specific variables for random tunables. perhaps we could add a generic variable where people could set "foo=bar" and openrc would blindly write "bar" to /proc/<pid>/foo ... probably need to be integrated into ssd ...
Meseems /etc/sysctl.d/foo-bar can't be usefull in this case. File /etc/sysctl.d/foo-bar should containt present pid to adjust score, service sysctl is started very early. So there is no pid for adjust. I'm not sure sysctl support /proc/pid, quote from man sysctl.conf: "The parameters available are those listed under /proc/sys/".
Will linux control groups take care of this? I'm thinking once that is in the tree we can close this bug as obsolete? Any thoughts?
cgroups are linux specific while writing to procs can be more general solution.
Cgroups can limit memory usage but when overcommit happens and all swap will be used then OOM will use scoring to choose task to kill. Maybe something more generic (in diffrent way) can be created: let implement postup() for each service (and variable which contains pid) and everyone will could write own tweak, like #455024 and #453772
I hope this bug isn't forgotten;)
See https://github.com/OpenRC/openrc/commit/fd1e4a384af44a8687b3a5369283f80f1cf29d84 (note that niceness is already ossible too). CCing Matt Whitlock as he implemented it, just as an FYI.