Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 565418 - Rework $PORTAGE_NICENESS and $PORTAGE_IONICE_COMMAND
Summary: Rework $PORTAGE_NICENESS and $PORTAGE_IONICE_COMMAND
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Unclassified (show other bugs)
Hardware: All Linux
: Normal normal with 3 votes (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-10 21:02 UTC by om3i
Modified: 2023-05-23 13:12 UTC (History)
3 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 om3i 2015-11-10 21:02:31 UTC
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
Comment 1 aperion 2020-11-07 16:30:23 UTC
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.
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-03-01 05:13:28 UTC
(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.
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-05-23 13:12:57 UTC
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>