Currently i have script as my PORTAGE_IONICE_COMMAND which sets cpu scheduling policy to idle, and scheduling class also to idle. >chrt --idle --pid 0 $1 >ionice --class 3 --pid $1 I think PORTAGE_NICENESS and PORTAGE_IONICE_COMMAND are not very well suited to what they suppoosed to do, because first only sets niceness but not scheduling class, and second does not allow to run multiple commands without use of external script. Reproducible: Always
I just recently noticed that PORTAGE_NICENESS was not working anymore. Apparently because of the autogroup feature. I was not able to make it work using autogroup. Now I aliased emerge to "chrt --idle 0 emerge", which is effective. It would be nice if portage could do that via configuration, potentially replacing the old variant. I think this could improve the user experience greatly. Because without this, I could not even watch video streams while emerge was active.
(In reply to aperion from comment #1) > I just recently noticed that PORTAGE_NICENESS was not working anymore. > Apparently because of the autogroup feature. I was not able to make it work > using autogroup. Now I aliased emerge to "chrt --idle 0 emerge", which is > effective. FWIW, this was addressed in bug 777492. As for the original issue, yeah, it sometimes feels like we should at least ship with an example commented out to easily reduce Portage's impact on system responsiveness (I'm not yet sure how we should best refactor the variables though). I've created a wiki page w/ my settings too for now: https://wiki.gentoo.org/wiki/User:Sam/PORTAGE_NICENESS.
commit 7dfa05c4446d1d2290d4ba61520a8f6ee9e57332 Author: KARBOWSKI Piotr <slashbeast@gentoo.org> Date: Sat Jan 14 21:13:40 2023 +0100 SCHEDULING_POLICY: switch to scheduler policy IDs rather than aliases. The os.SCHED_* aliases are not reliable enough, the mainline Python lacks deadline, and the pypy lacks them all together. The IDs are not going to change, at most new would arrive, so it is safe to use it as is. By extension, the deadline policy was also added, since those originally were not present in aliases. Bug: https://bugs.gentoo.org/867031 Closes: https://github.com/gentoo/portage/pull/976 Signed-off-by: KARBOWSKI Piotr <slashbeast@gentoo.org> Signed-off-by: Mike Gilbert <floppym@gentoo.org> commit 353c61912b134b326da5ac16ef1d4bc74b8967d1 Author: KARBOWSKI Piotr <slashbeast@gentoo.org> Date: Mon Aug 1 22:55:41 2022 +0200 Scheduling policy switching Adds ability to control the scheduler policy that is used for emerge and all child processes. Mainly to interface the ability to switch to SCHED_IDLE as the solution to keep interactive tasks unaffected by building process happening in the background. On a test sample N=1 with AMD Ryzen 5950x and 64 GB of ram building sys-devel/gcc with lto enabled significantly reduces responsiveness of the system, even with CONFIG_SCHED_AUTOGROUP and PREEMPT enabled. Using a web browser result in visible lags, video playback in web browser, when using CPU decoding, also suffers greatly. Switching Portage to SCHED_IDLE (PORTAGE_SCHEDULING_POLICY="idle") results in no visible slowdowns and responsiveness is as if nothing in the background was happening. This is especially worthy feature when running on powerful CPUs, where users often opt in to build not only with parallel build jobs, but also with multiple packages at once. Anyone running with PORTAGE_NICENESS="19" will undoubtedly want to use this feature to force SCHED_IDLE policy. Closes: https://github.com/gentoo/portage/pull/861 Signed-off-by: KARBOWSKI Piotr <slashbeast@gentoo.org> Signed-off-by: Mike Gilbert <floppym@gentoo.org>