Advertisements
200 Lines Kernel Patch that Improves responsiveness under system strain was an article recently published by Phoronix. While a Redhat developer Lennart Poettering replied on a mailing list to Linus Torvalds about an Alternative to this patch which does the same thing yet all you have to do is run 2 Commands and paste 4 lines in your ~/.bashrc file.
This may sound unbelievable, but someone even done some tests which proved that Lennart’s solutin works. Basically, Lennart explained about to add this to your~/.bashrc file (but this wont work on Ubuntu, so see the instructions for Ubuntu down the post).
CODE < # >
if [ "$PS1" ] ; then
mkdir -m 0700 /sys/fs/cgroup/cpu/user/$$
echo $$ > /sys/fs/cgroup/cpu/user/$$/tasks
fi
Now run the following Commands as super user:-
Linux Terminal $:-
mount -t cgroup cgroup /sys/fs/cgroup/cpu -o cpu
mkdir -m 0777 /sys/fs/cgroup/cpu/user
Further more, a reply to Lennart’s email states that his approach is actually better then the actual Kernel patch:
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
This reply also includes some benchmarks you can see @ http://lkml.org/ikml/2010/11/16/392.
How to use it on Ubuntu
To use Lennart’s solution in Ubuntu which is not tested yet, and thanks to Lsh for this step, you have to replace “/sys/fs” with “/dev“. So that you would have to add this following commands in your /et/rc.local (open it with : sudo gedit /etc/rc.local) file, above the “exit 0″ line.
Linux Terminal $:-
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
and now make it Executable :-
Linux terminal $:-
sudo chmod +x /etc/rc.local
To your ~/.bashrc file, add this following (to open it:gedit ~/.bashrc):
Linux Terminal $ :-
if [ "$PS1" ] ; then
mkdir -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
Now run this following Command:
Linux Terminal $:-
sudo gedit /usr/local/sbin/cgroup_clean
and paste this:
Code < # >
#!/bin/sh
rmdir /dev/cgroup/cpu/$*
Now save that file and make it executable:
Linux terminal $ :-
sudo chmod +x /usr/local/sbin/cgroup_clean
And finally, restart the computer or manually run the /etc/rc.local file (“sudo /etc/rc.local“).
November 19 Update: This above instructions has been updated again to “really” automatically remove empty cgroups, and thanks for Ricard Ferreira using the instructions HE SENT.
Patched Kernels Update 2 : Warning - use these at your own risk for Ubuntu 10.10 :-
If you want more to install a patched Kernel, you can Download a “200 lines” patched Kernel (64-bit only) from HERE, and thanking Phoronix forums.
Scott Franke shared a Kernel he patched with bfs with which he says he gets better performance then with the “200 lines patch”. Download:
* 32-bit : 1 and 2 (both .deb files required)
* 64-bit : 1 and 2 (both .deb files required)
Via:- Webupd8
