Two days back we reported about a 200 line patch for the Linux kernel which increases the system responsiveness under heavy load. The patch was applied to the Linux kernel not long ago and so it will take some time to appear for most of the users.
Interestingly, a RedHat developer, Lennart Poettering, has come up with an alternative to the kernel patch which does exactly the same thing. The most unbelievable thing about Poettering’s alternative is that it consist of just four lines of code which has to be added to the ~/.bashrc file.
Poettering’s method is ready for use by anyone. All you have to do is add the floowing lines of code in the ~/.bashrc file: (Note: I have not tried this myself.)
if [ "$PS1" ] ; then mkdir -m 0700 /sys/fs/cgroup/cpu/user/$$ echo $$ > /sys/fs/cgroup/cpu/user/$$/tasks fi
After adding these commands run the following commands as super user:
mount -t cgroup cgroup /sys/fs/cgroup/cpu -o cpu
mkdir -m 0777 /sys/fs/cgroup/cpu/user
It seems unbelievable that just these four lines of code can do the same function as a 200+ lines of kernel patch. However, there are indications that Poettering’s method might be actually better than the original kernel patch.
For Ubuntu users who want to try this, WebUpd8 has a step-by-step tutorial on how to do it.