r/linux • u/Waddle_n • Mar 11 '20
It's time for desktop distributions to adopt a responsive CPU scheduler
I understand keeping CFS in a server setting for maximum throughput, enterprise-level stability, or whatever you want to justify it with. But it's time desktop distributions started shipping a scheduler that keeps the desktop responsive. Arch packages Linux-zen and it is a much better out-of-the-box experience than the default kernel. I've also been testing these PKGBUILDs to sample PDS, MuQSS, and BMQ each for a week at a time, and here's my anecdotal experience:
- PDS, MuQSS, and BMQ keep a desktop GUI very responsive at 100% CPU load. For example, I could open Firefox and watch a YouTube video while doing a kernel compilation. Conversely, desktop GUIs becomes virtually unusable with the default CFS. This could affect normal users when, say, a resource-intensive game hangs, but it is near-impossible to escape to the GUI and kill it.
- MuQSS and BMQ kept my 3700x fed at 100% load, and offered comparable compile times to CFS. I don't have exact numbers for this, but kernel compilation takes me about 20 minutes on CFS, MuQSS, and BMQ. PDS was not maintaining a constant 100% load, and took about 1h 30m.
- PDS, MuQSS, and BMQ had comparable gaming performance to CFS. FlightlessMango has done several videos on this, and again it seems the takeaway is that performance is very similar, rarely differing by more than a few %. However, it is often the alternative schedulers that are performing slightly better.
Thus, I'd like to see other desktop-oriented distributions (say, Pop_OS!) start shipping MuQSS or BMQ. They are actively maintained and keep the desktop GUI responsive at all times, while performance is practically identical. I think this is a logical step to improve the out-of-the-box experience of the Linux desktop. Do you have any additional thoughts on why they should or should not be adopted?
35
u/igo95862 Mar 11 '20
Linux-zen actually uses CFS. It just tweaked it a bit.
Nothing stops distros from using same tweaks.
18
u/londons_explorer Mar 11 '20
I believe both Firefox and Chromium set their renderers to low scheduling priority as part of their sandboxes (the aim is that a malicious renderer not be able to DoS your computer).
If that's true, using a browser as an indication of "responsiveness" is invalid - by design it won't be responsive if the system is doing other work.
2
u/pkulak Mar 12 '20
Is this the issue that Stadia had been running into?
119
u/Sasamus Mar 11 '20 edited Mar 11 '20
To add another reason, while gaming performance in terms of pure fps does not increase much it's worth noting that the focus on responsiveness at the expense of throughput could hurt max fps, but could raise min fps as well as yield more even frametimes.
This means that even if average fps does not change much, if it goes down even, the gaming experience could still be improved by being smoother and with less input lag.
Another thing to note is that there already are distributions that do use a responsiveness tweaked kernel and an alternative scheduler. I can't recall which of the top of my head as I don't use them, just noticed at one point or another.
I agree with you, I don't really see much of a reason for why a desktop oriented distro should not do this.
What I can think of is that I've heard of some people that had negative effects with these kinds of changes. If that is somewhat common it could be a reason for some distros not wanting to do it, it benefits some users but comes at a cost for some others. The ratio of that I have no idea about though. I seem to hear more often about positive results than negative ones at the very least.
On a somewhat related note as you are using TK-Glitch's PKGBUILDS, you may want to look into the modprobeddb customization option and what that entails, as well as ccache for kernel compilation.
With my Ryzen 3900X I've gotten my kernel compilation down to just shy of 2 minutes with PDS.
35
u/Mgladiethor Mar 11 '20
i think io is more frequent system lockup, what happened to those schedulers?
68
u/blackcain GNOME Team Mar 11 '20
I'm leading a microconference at Linux Plumbers and one of the topics I'm looking to talk about is scheduler changes. But I rather not give a solution, but rather decide what is important in a scheduler for desktops.
47
u/GolbatsEverywhere Mar 11 '20 edited Mar 11 '20
I would suggest getting involved in whichever distro you care most about and pushing for your choice of scheduler there. (For Pop!_OS, it probably makes more sense to start by engaging with Ubuntu directly so that other Ubuntu-based distros benefit as well.)
In Fedora, we've been focusing heavily on system responsiveness recently, but our focus has mainly been on handling out-of-memory and I/O pressure situations. We haven't been looking at CPU scheduler because we didn't know this was even an issue. It's the sort of change we would consider if somebody were to present the case for doing so to us, but we need to have a good technical understanding of the pros/cons before making a change like this.
P.S. For some reason, Firefox is really bad at playing YouTube videos when the system is under heavy load. In comparison, playback is usually smooth in Epiphany even under heavy load. I don't know why.
9
u/[deleted] Mar 12 '20
Do CPU schedulers actually make such a big difference in responsiveness? To me, the following points make a far bigger difference:
vm.vfs_cache_pressure, swappiness and use zram to reduce disk I/O and increase cachingIn particular, I experience the disk to be the bottleneck for more often than the CPU.
5
u/[deleted] Mar 11 '20
Battery life -----> Server -----> GUI
This is the drama triangle that never ends. OP you made the rookie mistake of leaving out one of the prime offenders, the mobile battery users. And for future reference lets throw in "Cloud" like a big fog of war over this underlying problem.
17
u/Jannik2099 Mar 11 '20
Notify me when any of those get mainlined and don't regress with higher core counts
7
u/nicman24 Mar 11 '20
Lul Linux-zen does not even use anything but cfs
1
u/UnicornsOnLSD Mar 11 '20
Is it possible to use alternative schedulers on Manjaro? Would like to give this a try.
1
u/Iloveanimeandcartoon Apr 16 '20
OK can someone please explain this to me
6
u/Dragon20C Mar 11 '20
I agree with this, I have been following BMQ and it amazes me how much performance it brings to the table!
2
u/_AACO Mar 12 '20
liquorix + kisak ppa makes quite a big difference.
2
u/frackeverything Mar 14 '20
Any way to try these schedulers on a Ubuntu 18.04 based distro (KDE Neon)?
3
u/Aoxxt2 Mar 11 '20
Citation needed!
2
u/RedSquirrelFtw Mar 12 '20
This would be awesome, and it would actually 1 up Windows, because even Windows does not do that.
Why should my entire computer freeze because a mapped network drive is unavailable for example? Both Windows and Linux are guilty of this. The GUI stuff should be running as a priority thread and the back end stuff in a separate thread.
2
u/gnumdk Mar 11 '20
Tunes the kernel for responsiveness at the cost of throughput and power usage.
OK, so not wanted on a laptop and today desktop is mainly laptops.
1
u/DamonsLinux Mar 12 '20
I not test BMQ yet but tested muqss and please dont force enable it in default kernels! It work fine on new computers with more power but for old and weak pc it working like crap. Completly unresponsive, much worse than vanila kernel..
1
u/[deleted] Mar 12 '20
I can do that right now? I could do that on my machine 10 years ago? Where is the problem ?
Only really bad behaviour I noticed is when having fully encrypted disk bottlenecking CPU with disk encryption makes everything stutter but I doubt scheduler would fix it.
-1
u/dlarge6510 Mar 12 '20
I have no idea where this is coming from. There is no way you could make my desktop more responsive. I simply cant see where the slowdown could be.
However I am someone who can play a 15fps game just fine and struggle to see any difference with a 30fps game.
I must be wierd. Should I be allowed to drive? :O
-38
u/OdinHatesNickelback Mar 11 '20
Performance wise, we should all be going back to Windows.
CFS ain't the next point we should focus on.
-38
u/IKnowEnoughToGetBy Mar 11 '20
Have you tried Windows?
-16
u/[deleted] Mar 11 '20
That it matters not — one can do whatever one wants and if one be beholden by the "default" choices one's distribution makes, one is certainly idiotic enough that one has greater problems.
Dare I say it is intellectual Darwinism before my very eyes: the idiot pays the price for his idiocy — 'tis wondrous to behold.