TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

The ~200 Line Linux Kernel Patch That Does Wonders

420 点作者 pietrofmaggi超过 14 年前

15 条评论

jws超过 14 年前
I don't think I've managed to piece all this together, perhaps someone can fill in the blanks.<p>• The patch automatically creates a task group for each TTY.<p>• The patch automatically assigns each new process to the task group for its controlling TTY.<p>• In the case where there are large (&#62;cores) numbers of cpu bound jobs, the latency of interactive jobs is vastly improved.<p>I think the piece I'm missing is the behavior of the scheduler. Does it now make its decisions based on task group cpu consumption instead of process? I saw options to that effect back around 2.6.25.<p>Why is this an improvement over just nicing the "make -j64" into the basement and letting the interactive jobs have their way as needed? (Likely possibilities are that it is automatic, or maybe there is something about disk IO scheduling happening from the task groups as well.)
评论 #1910767 未加载
评论 #1910771 未加载
bobf超过 14 年前
I don't follow kernel development extremely closely, but it fascinates me that people are <i>still</i> actively working on the kernel's scheduler and achieving a "huge improvement" like this.
评论 #1911072 未加载
评论 #1910824 未加载
ludwigvan超过 14 年前
It makes me wonder whether it is a sign that desktop responsiveness has been neglected by the kernel devs which possibly prioritize server issues. I had read a Google engineer suggesting Canonical should hire decent kernel developers : " P.S. Next thing for Ubuntu to learn --- how to pay their engineers well enough, and how to give them enough time to work on upstream issues, that once they gain that experience on Ubuntu's dime and become well known in the open source community, they don't end jumping ship to companies like Red Hat or Google. :-)"<p><a href="http://news.ycombinator.com/item?id=1321029" rel="nofollow">http://news.ycombinator.com/item?id=1321029</a>
评论 #1912259 未加载
silentbicycle超过 14 年前
Here's the actual patch (<a href="http://marc.info/?l=linux-kernel&#38;m=128978361700898&#38;w=2" rel="nofollow">http://marc.info/?l=linux-kernel&#38;m=128978361700898&#38;w...</a>), with a bit of a summary of what it does.<p>I don't have enough context to fully follow it, but it sounds like it sets up a better hueristic for grouping related processes into task groups in the scheduler.
gxti超过 14 年前
So what's the downside? You almost never get optimizations like this for free. The post hints that this is also good for server workloads, but what suffers? Realtime would, but realtime usually involves a different scheduler anyway.
评论 #1910658 未加载
评论 #1912693 未加载
评论 #1921236 未加载
pietrofmaggi超过 14 年前
It's not down for me... but here's the text:<p>In recent weeks and months there has been quite a bit of work towards improving the responsiveness of the Linux desktop with some very significant milestones building up recently and new patches continuing to come. This work is greatly improving the experience of the Linux desktop when the computer is withstanding a great deal of CPU load and memory strain. Fortunately, the exciting improvements are far from over. There is a new patch that has not yet been merged but has undergone a few revisions over the past several weeks and it is quite small -- just over 200 lines of code -- but it does wonders for the Linux desktop.<p>The patch being talked about is designed to automatically create task groups per TTY in an effort to improve the desktop interactivity under system strain. Mike Galbraith wrote the patch, which is currently in its third version in recent weeks, after Linus Torvalds inspired this idea. In its third form (patch), this patch only adds 224 lines of code to the kernel's scheduler while stripping away nine lines of code, thus only 233 lines of code are in play.<p>Tests done by Mike show the maximum latency dropping by over ten times and the average latency of the desktop by about 60 times. Linus Torvalds has already heavily praised (in an email) this miracle patch.<p>Yeah. And I have to say that I'm (very happily) surprised by just how small that patch really ends up being, and how it's not intrusive or ugly either.<p>I'm also very happy with just what it does to interactive performance. Admittedly, my "testcase" is really trivial (reading email in a web-browser, scrolling around a bit, while doing a "make -j64" on the kernel at the same time), but it's a test-case that is very relevant for me. And it is a _huge_ improvement.<p>It's an improvement for things like smooth scrolling around, but what I found more interesting was how it seems to really make web pages load a lot faster. Maybe it shouldn't have been surprising, but I always associated that with network performance. But there's clearly enough of a CPU load when loading a new web page that if you have a load average of 50+ at the same time, you _will_ be starved for CPU in the loading process, and probably won't get all the http requests out quickly enough.<p>So I think this is firmly one of those "real improvement" patches. Good job. Group scheduling goes from "useful for some specific server loads" to "that's a killer feature".<p>Linus<p>Initially a Phoronix reader tipped us off this morning of this latest patch. "Please check this out, my desktop will never be the same again, it makes a <i>lot</i> of difference for desktop usage (all things smooth, scrolling etc.)...It feels as good as Con Kolivas's patches."<p>Not only is this patch producing great results for Linus, Andre Goddard (the Phoronix reader reporting the latest version), and other early testers, but we are finding this patch to be a miracle too. While in the midst of some major OpenBenchmarking.org "Iveland" development work, I took a few minutes to record two videos that demonstrate the benefits solely of the "sched: automated per tty task groups" patch. The results are very dramatic. UPDATE: There's also now a lot more positive feedback pouring in on this patch within our forums with more users now trying it out.<p>This patch has been working out extremely great on all of the test systems I tried it out on so far from quad-core AMD Phenom CPUs systems to Intel Atom netbooks. For the two videos I recorded them off a system running Ubuntu 10.10 (x86_64) with an Intel Core i7 970 "Gulftown" processor that boasts six physical cores plus Hyper Threading to provide the Linux operating system with twelve total threads.<p>The Linux kernel was built from source using the Linus 2.6 Git tree as of 15 November, which is nearing a Linux 2.6.37-rc2 state. The only change made from the latest Linux kernel Git code was applying Mike Galbraith's scheduler patch. This patch allows the automated per TTY task grouping to be done dynamically on the kernel in real-time by writing either 0 or 1 to /proc/sys/kernel/sched_autogroup_enabled or passing "noautogroup" as a parameter when booting the kernel. Changing the sched_autogroup_enabled value was the only system difference between the two video recordings.<p>Both videos show the Core i7 970 system running the GNOME desktop while playing back the Ogg 1080p version of the open Big Buck Bunny movie, glxgears, two Mozilla Firefox browser windows open to Phoronix and the Phoronix Test Suite web-sites, two terminal windows open, the GNOME System Monitor, and the Nautilus file manager. These videos just show how these different applications respond under the load exhibited by compiling the latest Linux kernel using make -j64 so that there are 64 parallel make jobs that are completely utilizing the Intel processor.
评论 #1910266 未加载
评论 #1910250 未加载
评论 #1910435 未加载
评论 #1910660 未加载
hippich超过 14 年前
I am newbie when it comes to compiling kernel. Is it a pain to do with stock ubuntu 10.10?<p>Sometimes I run something heavy on my laptop and desktop freezes annoy me. If this patch will allow me to get around it - I would be glad to try it out.<p>Anyone having url of some niuce tutorial to compile new kernel for ubuntu 10.10?
评论 #1910390 未加载
评论 #1910386 未加载
评论 #1911970 未加载
cookiecaper超过 14 年前
Anything from Phoronix should be taken with a grain of salt. This looks legit since it has a message from Linus praising the patch, but there have been several similar stories out of Phoronix that turn out to be hoaxes or misunderstandings.<p>That said, such a patch would be pretty rad.
zemanel超过 14 年前
i whish something similar could be ported to BSD/Darwin, OSX. I have a MBP 6,2 (i5) with 4GB mem/5400 rpm disk and it's quite easy to hog it down, to almost unbearable sometimes.
评论 #1910453 未加载
评论 #1910784 未加载
BoppreH超过 14 年前
9 upvotes and it's already down. Anybody has a mirror? This seems pretty useful.
评论 #1910842 未加载
teoruiz超过 14 年前
Just for the brave ou there: to build a custom kernel for Ubuntu, based on the actual Ubuntu kernel image, you have to follow these instructions:<p><a href="https://help.ubuntu.com/community/Kernel/Compile" rel="nofollow">https://help.ubuntu.com/community/Kernel/Compile</a><p>Apply the patch before compiling and there you go.
yason超过 14 年前
Makes me wonder that don't they have kernel APIs for process schedulers and I/O schedulers by now? The scheduler tweaks have been going on for ages.<p>Instead of compiling a single new kernel module (or downloading it prebuilt from an apt repo or a PPA) and kicking it in with modprobe, we now need to obtain the sources for the whole kernel, apply the patches, configure, build, and deploy. Sure Debian/Ubuntu has that partially automatized but it's still a pain.<p>At least I'll wait for stock 2.6.38 on Ubuntu and cross my fingers they put this patch in.
评论 #1912711 未加载
评论 #1911639 未加载
评论 #1911379 未加载
sliverstorm超过 14 年前
This is funny and cool at the same time- back when I still used Linux regularly, it was because it was way smoother than windows under load. I don't know if it regressed since then and was fixed, or just got better, but either is awesome!
slowpoison超过 14 年前
So, is this really going to help, if I don't have tons of busy processes (a'la "make -j64") running?
评论 #1912215 未加载
slaxor超过 14 年前
i am impressed, i have never expected such dramatic improvement on my desktop