this post was submitted on 05 Aug 2023
19 points (95.2% liked)

Linux

46819 readers
1090 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

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?

top 3 comments
sorted by: hot top controversial new old
[–] [email protected] 3 points 1 year ago
[–] [email protected] 1 points 1 year ago (1 children)

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.

[–] [email protected] 1 points 1 year ago

That’s unfortunate :(