aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Schmaus <flo@geekplace.eu>2021-03-21 12:07:38 +0100
committerZac Medico <zmedico@gentoo.org>2021-06-14 14:20:06 -0700
commit055abe523c2c3f6c8f1dccfb53565209222f90c1 (patch)
treed1761c6a9485d1ce92df3c0b875d1c0e547bc427 /repoman
parentRevert "PORTAGE_NICENESS: Consider autogroup scheduling" (diff)
downloadportage-055abe523c2c3f6c8f1dccfb53565209222f90c1.tar.gz
portage-055abe523c2c3f6c8f1dccfb53565209222f90c1.tar.bz2
portage-055abe523c2c3f6c8f1dccfb53565209222f90c1.zip
PORTAGE_NICENESS: Consider autogroup scheduling
With Linux's autogroup scheduling feature (CONFIG_SCHED_AUTOGROUP) setting a nice value on a per-process base has only an effect for scheduling decisions relative to the other threads in the same session (typically: the same terminal window). See the section "The nice value and group scheduling" in the sched(7) man page. Basically this means that portage "just" setting the nice value, has no effect in presence of autogroup scheduling being active (which is probably true for most (desktop) user systems). This commit changes emerge to set the autogroup's nice value, instead of the processes' nice value, in case autogroups are present (detected by the existence of /proc/self/autogroup). The tricky part about autogroup nice values is that we want restore the orignal nice value once we are finished. As otherwise, the session, e.g. your terminal, would continue using this value, and so would subsequently executed processes. For that we use Python's atexit functinaly, to register a function that will restore the orignal nice value of the autogroup. Users may have set PORTAGE_NICENESS to a value outside of the range of valid nice values [-20, 19]. Calling os.nice() with such a value will simply cap the process's nice value, but writing this invalid value to the autogoup pseudo-file will fail with "Invalid argument". Since os.nice() returns the current nice value, we simply use the returned value to set the autogroup nice value. Portage would previously always change the nice value to zero, even if the user did not explicitly request so. Now we do not change the nice value unless requested. Closes: https://github.com/gentoo/portage/pull/727 Bug: https://bugs.gentoo.org/777492 Signed-off-by: Florian Schmaus <flo@geekplace.eu> Signed-off-by: Zac Medico <zmedico@gentoo.org>
Diffstat (limited to 'repoman')
0 files changed, 0 insertions, 0 deletions