The Linux Speed Boost!

Oh my, it has been a while since I visited my Blog. While there were few worthy posts which I should have blogged about, that never happened. Recently, when I came across a post on OMG Ubuntu, about a new kernel patch which supposedly speeds up Linux, I just had to try it out. Its been a while since I've compiled my own kernel (these days I rely on stock Ubuntu), but after seeing the results myself thought it was very much blog worthy for me to share with you.

First off, for the impatient or the unmotivated, let me point you to another post on Phoronix, which contains a video showing the night and day difference this patch brings. If your still not impatient, then you could wait for 2.6.38, which will hopefully have this, considering Linus's supportive comments, regarding the patch.

Ok now for the glory details on getting this patch up and running. I did this on Ubuntu 10.10 but it should work the same for other Debian and Debian like distros as well as other popular distros with minor tweaks.


Get the kernel

Download the kernel 2.6.37 from kernel.org. At the time of writing, 2.6.37 had not been officially released and was at RC2


cd /usr/src
wget http://www.kernel.org/pub/linux/kernel/v2.6/testing/linux-2.6.37-rc2.tar.bz2
tar jxf linux-2.6.37-rc2.tar.bz2



Get the patch

The patch published by Mike Galbraith can also be copied from here. Save it to a file called kernelboost.patch in /usr/src/kernelboost.patch


Dry-run and Apply patch

Go to the kernel directory and dry-run the patch to make sure it applies cleanly. If everything is ok, go ahead and apply for real ;)


cd /usr/src/linux-2.6.37-rc2
patch --dry-run -p1 < /usr/src/kernelboost.patch

#if everything is ok
patch -p1 < /usr/src/kernelboost.patch



Configure and compile the kernel

This is a generic step of compiling the kernel. The configuring step can be performed using your current config file. Make sure you enable the patch by answering Y to CONFIG_SCHED_AUTOGROUP.


cp /boot/config-2.6.35-22-generic /usr/src/linux-2.6.37-rc2/.config
make oldconfig
make
make modules_install
make install


If your on Ubuntu, I'd recommend installing the kernel the Debian way instead of using the make, make modules_install and make install steps.


apt-get install kernel-package fakeroot build-essential ncurses-dev
cd /usr/src/linux-2.6.37-rc2
sed -rie 's/echo "\+"/#echo "\+"/' scripts/setlocalversion
make-kpkg clean
CONCURRENCY_LEVEL=`getconf _NPROCESSORS_ONLN` fakeroot make-kpkg --initrd --append-to-version=-custom kernel_image kernel_headers

cd ..




You should find two .debs in /usr/src related to the new custom kernel. Install using dpkg -i or by double clicking on the deb from the file manager. Once you reboot to the new kernel everything should be all set. Just to double check make sure :


cat /proc/sys/kernel/sched_autogroup_enabled
1


If it has 1 then its enabled. You can echo 0 > /proc/sys/kernel/sched_autogroup_enabled to disable the scheduler on the fly.

I noticed a significant improvement when trying to play BioShock from Steam using CrossOver Games. With the previous kernel, I had a lot of lag, especially with Compiz turned on. For instance, when moving the mouse to look around, it was very much discrete. Now I notice things are smoother and the game is much playable.

Your experience may be different depending on how you use the computer. Chances are that if you tend to use CPU hogging applications such as playing games or watching HD movies, you will notice an improvement.

Till next time a blog worthy event that excites me happens~

Comments

Anonymous said…
Hey, good to see you back on the blogsphere Bud.

Guess I'd better give the new patch a try now :)
dakshika said…
ah... Buds back... i'll try this ton8..can u write sm article abt virtualization. ..
geekaholic said…
Thanks @seejay and @කරුමක්කාරයා I shall *try* to write more technical articles. Don't consider this as me coming back as I never really left ;)
Anonymous said…
Cool...
But somebody thinks otherwise
http://www.webupd8.org/2010/11/alternative-to-200-lines-kernel-patch.html
Unknown said…
should try this after the semester ends. Or will it be available on updates by that time. :D may be. But at the time can't crash my lap because number of assignments are going on.
geekaholic said…
@galpotha That is most interesting. Must try it later tonight with Ubuntu official kernel and compare.
Unknown said…
I tried this and after installing the kernal deb, I got a kernal panic error saying "Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block".

After updating the initramfs and grub it started to work. :D

Steps I followed to fix the kernal panic.

1. Boot the machine using ubuntu live CD
2. chroot and mount your old file system
3. sudo update-initramfs -c -k 2.6.37-rc3-custom
4.sudo update-grub
Anonymous said…
Encountered a mismatch doing this. Probably my fault because I did things in a hurry. However whole system got crashed and had to re-install Ubuntu. Today I saw a blog post. After following their script's finally I made it. There's actually a boost in the patch. Thank you so much.
Bud , thanks for this good article.
I can see significant performance improvement after applying this patch on my dv6/Ubuntu 10.10 (64).
geekaholic said…
@madhaw4 chances are your initrd was at fault. In anycase you could have booted off of the previous kernel rather than reinstall. Anyway good it worked out in the end.

Anyone try the redhat guys method which requires no kernel patch?

Popular posts from this blog

Why KDE4 (might) suck!

Track Your New Year Resolutions With ii.do

Re-installations made easy with Install Buddy