tl;dr question: How do I get the Handbrake Flatpak to operate at a high niceless level in its own cgroup by default? I’m using Fedora Linux.

So if I understand things correctly, niceness in Linux affects how willing the process scheduler is to preempt a process. However, with cgroups, niceness only affects this scheduling relative to other processes within a cgroup. This means a process running with a high niceness in its own cgroup has the same priority as other processes in equivalent cgroups, and it will not in fact be preempted in a way one would expect.

So why does this matter to me at all? I have a copy of Handbrake installed from Flatpak. And sometimes I want to encode a video in the background while still having a decently responsive desktop experience so I can do other things, and basically let Handbrake occupy the cpu cycles I’m not using. Handbrake and the video encoding process should be at the bottom priority of everything to the maximum extent possible.

But it does not appear to be enough to just go into htop and set the handbrake process’s niceness level to 19 and then start an encode, because of the cgroup business I mentioned above.

Furthermore, in my opinion Handbrake should always be the lowest priority process without my having to intervene. I would like to be able to launch it without having to set its niceness. Does anybody have suggestions on this? Is my understanding of the overall picture even correct?

  • Atemu@lemmy.ml
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    You can’t. Scheduling priority is fucked in all sorts of ways in CFS.

    Nice just straight up has no useful meaning nowadays and the alternatives can’t really make a background process not significantly impact “foreground” ones either.

    Best you can to is limit kow many cores a cgroup is allowed to use.