Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 361073 - sys-apps/openrc: allow tweaking of /proc settings on a per-service basis
Summary: sys-apps/openrc: allow tweaking of /proc settings on a per-service basis
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: OpenRC (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: OpenRC Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-29 09:29 UTC by Marcin Mirosław
Modified: 2023-01-29 02:53 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcin Mirosław 2011-03-29 09:29:42 UTC
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
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2011-03-31 17:52:21 UTC
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>).
Comment 2 SpanKY gentoo-dev 2011-03-31 19:15:59 UTC
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 ...
Comment 3 Marcin Mirosław 2011-03-31 20:56:41 UTC
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/".
Comment 4 William Hubbs gentoo-dev 2013-02-18 07:12:46 UTC
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?
Comment 5 Alexander Vershilov (RETIRED) gentoo-dev 2013-02-18 19:26:43 UTC
cgroups are linux specific while writing to procs can be more general solution.
Comment 6 Marcin Mirosław 2013-02-19 12:48:51 UTC
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
Comment 7 Marcin Mirosław 2015-08-10 08:00:19 UTC
I hope this bug isn't forgotten;)
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-01-29 02:53:50 UTC
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.