65

I read today on Phoronix that there is a 200 line patch to the Linux Kernel which dramatically improves desktop responsiveness.

How can Ubuntu users get this in a way that's supported?

6 Answers 6

59

Discussion regarding this specific patch took place on the Ubuntu kernel-team mailing list:

https://lists.ubuntu.com/archives/kernel-team/2010-November/013498.html

But let me try to elaborate even more generically about the best way for any patch to make its way into the Ubuntu kernel...

First, it's the preferred policy of the Ubuntu Kernel Team that patches be submitted and accepted upstream before being pulled into the Ubuntu kernel. It's a large maintenance burden on the Ubuntu Kernel Team to have to maintain out of tree patches. Additionally, if the patch will benefit the entire Kernel Community, it should go upstream first.

Once the patch has been accepted upstream, it will eventually make its way into the Ubuntu kernel automatically. A cherry-pick or pull request could also be made if one so desired, see the page, KernelPatches, for more information.

If the patch needs to be applied as an SRU (stable release update) to a previous Ubuntu release it's best to get the patch accepted into the corresponding upstream stable 2.6.x.y tree. As a part of our normal kernel SRU process, we continually rebase to the latest upstream stable kernel. Thus we would again eventually get the patch automatically.

3
  • 4
    This patch is likely to be in the v2.6.38 kernel, which would mean it is likely to be in the Natty release. We will know better once the patch appears in Linus' tree.
    – Andy
    Nov 17, 2010 at 19:34
  • 1
    @Andy: Update - good news: Ubuntu 11.04 Natty Narwhal released yesterday, contains 2.6.38, which contains the patch. Apr 29, 2011 at 10:49
  • Unfortunately, the "Ubuntu kernel-team mailing list" link appears to be dead, or incorrect. Feb 11, 2016 at 18:25
20

I've just read the lkml thread and hope I can offer some information - although not about getting the patch into Ubuntu. As a post on the linked Ubuntu list says, it's probably going to be in 2.6.38 anyway.

The patch automatically groups process based on TTYs. There is a lot of discussion/argument on the lkml that says this means it isn't relevant for typical desktop usage - that it makes no difference to interactive applications. The test cases are all based around "start a CPU intensive task from a terminal then look at the responsiveness of another task". So compiling a kernel and trying to watch a video, for example.

That's not to say it's not good, but the general "desktop responsivity improved by an order of magnitude" type headlines could be misleading if you never run CPU intensive tasks connected to a TTY. I could be wrong of course though!

There were some mentions of ways of achieving a very similar result by adding to your bash scripts and allowing all users to create cgroups. This will only work if current Ubuntu kernels have cgroups enabled. The relevant posts are:

Obviously this isn't answering the question, but it could be used to determine whether the patch is as magical as hoped.

1
  • 4
    I think more people need to realise this.
    – Roddie
    Nov 17, 2010 at 11:31
12

How can Ubuntu users get this in a way that's supported?

Emphasis mine. The only way you'll get it in a supported way is by waiting for Ubuntu to pull it into the Ubuntu kernel. As this is really just making it to the kernel mailing list, it's fresh to the point where all testing is fairly anecdotal and I imagine it will be some time before it's ready to be mass-deployed.

Somewhere between the next release and a long time would be my uneducated guess.


But if you're a big boy (or girl) and you can cope with a broken kernel if things go wrong (ie you know how to use grub), you can patch and compile your own kernel.

  1. Download a patch. There are different versions but the best on its own was posted below by another user: http://pavlinux.ru/krnl/sched_autogroup-2.6.36.patch.bz2

  2. Download the kernel source for the version your patch targets. In this case 2.6.36. You can get vanilla (that is original, unmodified by the Ubuntu kernel team) kernel sources from kernel.org and extract it.

  3. Save the patch somewhere and apply it by cding into the kernel source dir and running: patch -p1 < /path/to/patch (you need the patch package for this... Which I think comes as part of build-essential if it's not installed by default)

  4. And then continue with the rest of the "old fashioned" build process... I really wouldn't bother with the newer methods as they're aimed at Ubuntu/Debian-sanctioned kernel sources... Plus the old way seems easier (to me).

Building kernels isn't hard but you can mess it up if you stray too far from the accepted path. And you won't get official support if things go wrong.


Alternatively, there are more and more kernels emerging with the patch built in (or at least in the source tree, awaiting the next release).

  • I believe Zen Kernel has this patch in their tree but I'm not sure if it's in any builds yet.
  • The Liquorix Kernel has this baked in now too.

Note: both these kernels (and probably others too) deviate from the Ubuntu way of doing kernels somewhat. You may find (as I did when I moved to Liquorix) that CPU frequency scaling stops working or suspend gets broken. There are usually fixes and workarounds, but chances are you won't get support from AskUbuntu or the rest of the Ubuntu communtiy as we can't check every single kernel out there.

3
  • Someone, somewhere has to have this patch already applied in a public git branch. Too big of news to not, but my google-fu is failing me. Nov 16, 2010 at 23:51
  • @Karl zen kernel have it in their git tree.
    – Oli
    Nov 16, 2010 at 23:57
  • The liquorix has this applied amongst a whole load of other patches. I'm running on it now and it's quite nice. One major issue for me (and probably most other users) is CPU_FREQ appears to be a bit knackered. It's stuck on PERFORMANCE.
    – Oli
    Nov 17, 2010 at 15:25
5

You can use a simple "hack" posted by a RedHat developer on a mailing list, that doesn't require patching the kernel to get the same thing. Read about it here: Alternative To The "200 Lines Kernel Patch That Does Wonders" Which You Can Use Right Away

1
  • Please include details from the link as if it were to become nonfunctional, your answer would not help users.
    – nanofarad
    Sep 16, 2012 at 12:45
1

As of 2011-01-18, Linux 2.6.38-rc1 includes the said patch.
See the related Phoronix news and Linus post.

As of 2011-01-29, the Natty Narwhal daily build ships with Linux 2.6.38.

So, there are currently two solutions :

0

I just picked this discussion up now and its very interesting. I have written a small blog post on how to enable the cgroup patch on Ubuntu 10.10.

I haven't really tested if it works or not, so feedback would be great!

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .