openrc/src
Matt Whitlock 112b69860f start-stop-daemon, supervise-daemon: set autogroup nicelevel
As described in "Why nice levels are a placebo and have been for a very
long time, and no one seems to have noticed"[1], the Linux kernel in its
default configuration on many Linux distributions autogroups tasks by
session ID and "fairly" allocates CPU time among such autogroups. The
nice levels of tasks within each autogroup are only relative to
other tasks within the same autogroup. Effectively, this means that the
traditional nice level is rendered moot for tools like start-stop-daemon
and supervise-daemon, which start each daemon in its own session and
thus in its own autogroup. Linux does provide a means to change the
niceness of autogroups relative to each other, so let's have start-stop-
daemon and supervise-daemon make use of this feature where available so
that -N,--nicelevel/SSD_NICELEVEL will actually do what the user
intends. On systems where autogroups are not supported or are disabled,
this commit introduces no change in behavior.

Note that the setsid() call in the child process of start-stop-daemon is
moved to much earlier. This is necessary so that the new process will be
assigned to a new autogroup before the autogroup nicelevel is set. To
avoid inadvertently acquiring /dev/tty as the controlling terminal of
the new session after setsid() has given up the controlling terminal
inherited from the parent process, tty_fd is opened before the call to
setsid().

[1] https://www.reddit.com/r/linux/comments/d7hx2c/why_nice_levels_are_a_placebo_and_have_been_for_a/
This fixes #542.
2022-09-06 17:26:22 -05:00
..
checkpath checkpath: fix memory leak 2022-05-08 14:56:26 -05:00
einfo multiple spelling and typo fixes 2022-04-30 21:32:32 -05:00
fstabinfo multiple spelling and typo fixes 2022-04-30 21:32:32 -05:00
halt migrate fully to meson build system 2022-04-06 10:51:55 -05:00
is_newer_than migrate fully to meson build system 2022-04-06 10:51:55 -05:00
is_older_than migrate fully to meson build system 2022-04-06 10:51:55 -05:00
kill_all migrate fully to meson build system 2022-04-06 10:51:55 -05:00
libeinfo multiple spelling and typo fixes 2022-04-30 21:32:32 -05:00
librc librc: fix resource leaks 2022-05-08 17:10:44 -05:00
mark_service migrate fully to meson build system 2022-04-06 10:51:55 -05:00
mountinfo migrate fully to meson build system 2022-04-06 10:51:55 -05:00
on_ac_power migrate fully to meson build system 2022-04-06 10:51:55 -05:00
openrc openrc: fix help messages 2022-07-21 03:53:42 -04:00
openrc-init migrate fully to meson build system 2022-04-06 10:51:55 -05:00
openrc-run multiple spelling and typo fixes 2022-04-30 21:32:32 -05:00
openrc-shutdown multiple spelling and typo fixes 2022-04-30 21:32:32 -05:00
poweroff migrate fully to meson build system 2022-04-06 10:51:55 -05:00
rc-abort migrate fully to meson build system 2022-04-06 10:51:55 -05:00
rc-depend migrate fully to meson build system 2022-04-06 10:51:55 -05:00
rc-service migrate fully to meson build system 2022-04-06 10:51:55 -05:00
rc-sstat multiple spelling and typo fixes 2022-04-30 21:32:32 -05:00
rc-status rc-status: fix mismatched alloc 2022-05-08 14:56:26 -05:00
rc-update rc-update: style fixes 2022-05-08 14:56:26 -05:00
reboot migrate fully to meson build system 2022-04-06 10:51:55 -05:00
seedrng seedrng: initialize seed_dir 2022-04-20 20:49:47 -05:00
service migrate fully to meson build system 2022-04-06 10:51:55 -05:00
shared shared/misc.c: free env_allow if returning early from env_filter 2022-05-08 14:56:26 -05:00
shell_var migrate fully to meson build system 2022-04-06 10:51:55 -05:00
shutdown migrate fully to meson build system 2022-04-06 10:51:55 -05:00
start-stop-daemon start-stop-daemon, supervise-daemon: set autogroup nicelevel 2022-09-06 17:26:22 -05:00
supervise-daemon start-stop-daemon, supervise-daemon: set autogroup nicelevel 2022-09-06 17:26:22 -05:00
swclock migrate fully to meson build system 2022-04-06 10:51:55 -05:00
value migrate fully to meson build system 2022-04-06 10:51:55 -05:00
meson.build migrate fully to meson build system 2022-04-06 10:51:55 -05:00