Niceness and Cgroups. How do I change this correctly?
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?