[Nottingham] A wild 200 lines patch in the Linux scheduler!

Martin martin at ml1.co.uk
Sat Nov 27 01:27:02 UTC 2010


Folks,

There's quite a flurry on various forums about a magical 200 line patch
to the Linux kernel that is supposed to do unbelievable magic!

The ~200 Line Linux Kernel Patch That Does Wonders
http://linux.slashdot.org/story/10/11/16/1330233/The-200-Line-Linux-Kernel-Patch-That-Does-Wonders

####
"There is a relatively miniscule patch to the Linux kernel scheduler
being queued up for Linux 2.6.38 that is proving to have dramatic
results for those multi-tasking on the desktop. Phoronix is reporting
the ~200 line Linux kernel patch that does wonders with before and after
videos demonstrating the much-improved responsiveness and interactivity
of the Linux desktop. ... Linus Torvalds has shared his thoughts on this
patch: 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.'"
####

Alternative To the 200-Line Linux Kernel Patch
http://linux.slashdot.org/story/10/11/18/2246213/Alternative-To-the-200-Line-Linux-Kernel-Patch

####
... Lennart Poettering, a Red Hat developer, replied to Linus Torvalds
on a mailing list with an alternative to this patch that does the same
thing yet all you have to do is run 2 commands and paste 4 lines in your
~/.bashrc file."
####

The ~200 Line Linux Kernel Patch That Does Wonders
http://www.phoronix.com/scan.php?page=article&item=linux_2637_video&num=1

####
... 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.

    "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.

    I'm also very happy with just what it does to interactive
performance. ..."
####

Alternative To The "200 Lines Kernel Patch That Does Wonders" Which You
Can Use Right Away
http://www.webupd8.org/2010/11/alternative-to-200-lines-kernel-patch.html

####
... ll you have to do is run 2 commands and paste 4 lines in your
~/.bashrc file. I know it sounds unbelievable, but apparently someone
even ran some tests which prove that Lennart's solution works. Read on! ...
####


So... What's all that about?

It all seems to be around how to get a Linux desktop (or laptop) remain
responsive despite running 64 compile jobs all at the same time AND
without tinkering with "nice" or "ionice" to push the big parallel
kernel compile down to a low priority.

The trick and the pitfall is nicely (sorry, a very low pun!) explained in:

http://linux.slashdot.org/comments.pl?sid=1874692&cid=34278478

####
... If you don't know what CPU scheduling is, think of it as form of
mind reading. I'll illustrate.

Lets say you have asked your computer to do several things, ...

... The people who will benefit from this are the ones that use the
command line heavily and regularly. People like Linus. Which is why he
liked it so much I guess. But these are precisely the people who will
have no absolutely no trouble doing it [the CPU group scheduling trick]
the manual way.
####



So, all clever stuff but you still don't get something for nothing.

The new scheduling trick appears to first partition the compute
resources equally across all "TTYs" to in effect equally divide
resources across the tasks (groups) a user starts. Hence the example of
the 64 parallel compile processes are all lumped as one task and suffer
an equal share as a group against even just single processes in other
groups. Hence, the kernel compile doesn't hog an unfair and detrimental
to the user experience x64 share of the CPU.


Is trying to work to such extremes all a hang-over of the days of
compiling on big multi-user mainframes and the tricks of pushing your
one job through the fastest?...

Interesting fun. Not sure that it really is a performance boost, but it
might make systems a little more robust against aggressively
multi-threaded applications!

Good for some controversy!

Cheers,
Martin


-- 
----------------
Martin Lomas
martin at ml1.co.uk
----------------



More information about the Nottingham mailing list