7 ms·
How Con Kolivas's BFS CPU scheduler works
- DarkShikari 17y agoOne advantage of BFS is the fact that it is very simple: the sheer number of heuristics that have made their way into CFS have a tendency to cause all sorts of problems in--often rather important--pathological cases. Here's one example from a recent commit: http://patchwork.kernel.org/patch/47921/ http://patchwork.kernel.org/patch/47921/ The speed loss was so huge on what should have been an extremely easy load that it probably explains quite a few "Windows is faster than Linux" benchmarks I've seen over the past few months...
- deleted 17y ago[deleted]
- ars 17y agoI have to say it looks really really good. It's tuned specifically for desktop needs. What are the chances of this getting into mainline? Yes, I read about his history. Maybe it will go in anyway. (But it really needs a new name - any suggestions for a better back-ronym?) One thing I did not see that it has, is hyperthreading support, i.e. detecting that two cores are really the same, and not scheduling two tasks on the same core, while other are available. And also, not scheduling idle priority tasks on a core used by other tasks. I emailed him to ask.
- jrockway 17y agoDo desktop workloads benefit from hyperthreading? If not, there is no need to clutter this code with support for it.
- wmf 17y agoNew Intel desktop/laptop systems have hyperthreading on by default, so the real question is whether desktop workloads are hurt by HT. In that case BFS could improve performance by avoiding co-scheduling (which it currently doesn't appear to do).
- jrockway 17y agoIt is disabled by default on every Intel system I own. But anyway, if people are using unstable Linux scheduling algorithms, I bet they are OK tweaking their BIOS settings, too.
- altie 17y agoThere isn't one answer for either desktop or server workloads, only trends. Some processor resources get cut in half between threads, some are duplicated and the threads compete for some others. If your favorite benchmark bottlenecks on a resource that's shared or divided between threads, it'll probably do worse with hyperthreading on; if that's not the case, and a lot of the instructions in the hot path can go to any decoder or ALU, it'll probably do better.
- ars 17y agoHe replied: > Does BFS support hyperthreading? > Meaning, detecting that two cores are really the same, and not scheduling two tasks on the same core, while others are available. The answer to that is "somewhat". It depends on the topology and workload, but it does not do anything like the complex balancing the mainline scheduler does to achieve this. I don't have enough hardware to see how it works in the real world on different topology and what workloads and how that compares to mainline. > And also, not scheduling idle priority tasks on a core used by other tasks. It does nothing smart to separate idle priority tasks from normal ones on SMT siblings vs cores. And to answer the obvious question that follows these, I don't anticipate I'll be adding any more complex HT management than is already there as that will sway from the philosophy of BFS. Regards, Con
- Scott_MacGregor 17y agoThis thing needs a better name. I can see the technology benefit, but commercially it needs a more technologically correct (P.C.) name. If this is sold, the publicity people will have heart attacks and the legal documents will come up on porn searches. Not the best business strategy to peruse if the developers want to maximize the value of this asset.
- dkarl 17y agoWhat kind of product do you envision that would be named after, or whose marketing material would even mention by name, a process scheduler?
- ars 17y agoBusiness Purchase Order for RedHat licenses with BFS scheduler for the developers. Just don't say what BFS stands for. OK, it's a bit of a stretch that they'll say what the scheduler is on the PO, but it could happen. It needs a backronym. Bloody Fine Scheduler? Bazinga Fast Scheduler? BigBang Feory Scheduler? :)
- trafficlight 17y agoTraditionally, BFx stands for "Big Fucking x". For example the BFG 9000 http://en.wikipedia.org/wiki/BFG_9000 http://en.wikipedia.org/wiki/BFG_9000
- Scott_MacGregor 17y agoNot necessarily marketing material, but a lot of big companies like to issue press releases when they add something or buy something. Plus, if it is picked up and used by any big name in the industry some of the blogs will probably pick it up and make a mockery out the name using their so-called clever writing skills, lol. From a business standpoint, this might be a concern for some companies. I can’t see any "positive business reason" to have a name like that, it only seems like a negative to me.
- jsrn 17y ago
- jws 17y agoIf the scheduler's purpose is "to make typical desktop loads feel better", how do you benchmark that? There is certainly room for improvement in making the Linux desktop feel good, but I don't know how one would get to a number. Perhaps you'd have to resort to double blind comparison tests. (FWIW, my 1.2GHz PPC running Debian performs unacceptably as a desktop machine. There are sometimes >1000ms lags between a keypress and it being reflected on the X11 display with no background load. But I can't say this is because of the scheduler.)
- ars 17y ago> But I can't say this is because of the scheduler. Yes you can. And you answered your own question: latency is exactly how you benchmark this (with a measure of total throughput added in to make sure it's not low).
- jacquesm 17y agoThat sounds like a classical example of starvation.
- viraptor 17y ago> how do you benchmark that? By getting statistics from the scheduler itself: how long did the process have to wait before it started executing. Also by looking at global effects: run N mplayers at the same time and look for dropped frames ; run an app that maps similar amount of work to N children and measure the run time ; measure the time needed for compiling [big project] with concurency == number of cpus ; ...
- wallflower 17y agoFor Windows users, Bitsum's Process Lasso does an admirable job of maintaining desktop responsiveness. http://www.bitsum.com/prolasso.php http://www.bitsum.com/prolasso.php
- zokier 17y agoSo it's a scheduler on top of the kernels scheduler. Sounds ingenious...
- yason 17y agoIs there a scheduler API in Linux kernel already? If there isn't, it seems that developing schedulers would really benefit from the ability to have them loaded / unloaded as kernel modules, like filesystems. The system could fall back to some generic round-robin scheduler if none of the more advanced schedulers were loaded, or when switching between schedulers. I would want to try out BFS but I'm old enough to not take the time and effort to compile and patch my own kernel anymore, so I'll probably just wait until BFS becomes the default in mainstream kernels. If ever, considering the scheduler wars in the recent years. A single kernel module I could compile and try out pretty easily, especially with module-assistant. Or if there's a .deb of Ubuntu kernel patched with BFS, that would do too. I'm lazy, yes. Until I hack the Linux kernel day and night myself, it's probably better this way. But I would still like to try out BFS, up to some degree.
- alextp 17y agoLinus is openly opposed to the idea of scheduler modules, his argument being that schedules are core parts of a kernel, and modularizing schedulers woud encourage many different schedulers each good at a simple thing instead of a single scheduler well optimized for all workloads.
- joeyo 17y agoIt looks like we are getting that anyway, modular schedulers or no.
- alextp 17y agoUntil Linus goes commando and rewrites the scheduler, like he did with git, yeah.
- yason 17y agoYeah, the conclusion was something like this a couple of years ago when the issue was brought up on LKML. Too bad his opinion hasn't changed. I don't think it's a good idea to wait for the perfect one-size-fits-all scheduler instead of supporting competition between different schedulers. People have different needs and hence they need different schedulers -- I might suggest that it's be the only way to ever find the well-optimized single scheduler.