Lennart Poettering, a RedHat developer replied to Linus Torvalds on a maling 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. I know it sounds unbelievable, but apparently someone even ran some tests which prove that Lennart's solution works. Read on! Phoronix recently published an article regarding a ~200 lines Linux Kernel patch that improves responsiveness under system strain. Well,replied to Linus Torvalds on a maling list with anI know it sounds unbelievable, but apparently someone even ran some tests which prove that Lennart's solution works. Read on!

Basically, Lennart explains you have to add this to your ~/.bashrc file (important: this won't work on Ubuntu. See instructions for Ubuntu further down the post!):

if [ "$PS1" ] ; then mkdir -m 0700 /sys/fs/cgroup/cpu/user/$$ echo $$ > /sys/fs/cgroup/cpu/user/$$/tasks fi

mount -t cgroup cgroup /sys/fs/cgroup/cpu -o cpu mkdir -m 0777 /sys/fs/cgroup/cpu/user

I've done some tests and the result is that Lennart's approach seems to work best. It also _feels_ better interactively compared to the vanilla kernel and in-kernel cgrougs on my machine. Also it's really nice to have an interface to actually see what is going on. With the kernel patch you're totally in the dark about what is going on right now.



-Markus Trippelsdorf

Use it in Ubuntu

Update (November 24): because many people had trouble following the instructions below, there is now a script that automatically does everything for you. See: Script To Automatically Apply the "200 Lines Kernel Patch" Alternative In Ubuntu

To use Lennart's solution in Ubuntu ( not tested - thanks to Lsh for this), you have to replace "/sys/fs" with "/dev". So you would have to add the following commands in your /etc/rc.local (open it with: sudo gedit /etc/rc.local) file, above the "exit 0" line:

mkdir -p /dev/cgroup/cpu mount -t cgroup cgroup /dev/cgroup/cpu -o cpu mkdir -m 0777 /dev/cgroup/cpu/user echo "/usr/local/sbin/cgroup_clean" > /dev/cgroup/cpu/release_agent

sudo chmod +x /etc/rc.local

if [ "$PS1" ] ; then mkdir -p -m 0700 /dev/cgroup/cpu/user/$$ > /dev/null 2>&1 echo $$ > /dev/cgroup/cpu/user/$$/tasks echo "1" > /dev/cgroup/cpu/user/$$/notify_on_release fi

sudo gedit /usr/local/sbin/cgroup_clean

#!/bin/sh if [ "$*" != "/user" ]; then rmdir /dev/cgroup/cpu/$* fi

sudo chmod +x /usr/local/sbin/cgroup_clean

Update November 19: The above instructions have been updated again to "really" automatically remove empty cgroups (thank to Ricardo Ferreira using the instructions The above instructions have been updated again to "really" automatically remove empty cgroups (thank to Ricardo Ferreira using the instructions he sent .).

If you want to go even further and install a patched Kernel, you can download a "200 lines" patched Kernel (for 64bit only!) from HERE (thanks to accumulator @ Phoronix forums ).





Also, WebUpd8 reader Scott Franke shared a Kernel he patched with bfs with which he says he gets better performance then with the "200 lines patch". Download (also 64bit only!): 1 and 2 (both .deb files required).





Both of the above 2 Kernels are for Ubuntu 10.10 only! Use them at your own risk!

Read the discussion @ http://lkml.org/lkml/2010/11/16/392 | via Habrahabr.ru (thanks to Lsh)

And run the following commands as super user:Further more, a reply to Lennart's email states that his approach is actually better then the actual Kernel patch:and make it executable:And then add the following to yourfile (to open it:):Run the following command:And paste this:then save the file and make it executable:And finally, restart the computer or manually run the /etc/rc.local file ("sudo /etc/rc.local").More on this topic: