RedHat Developer Comes Up With Alternative To The “Magic” 200 Line Kernel Patch

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

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.

Published by

Ricky Laishram

Ricky Laishram is a Linux and FOSS enthusiast. He is passionate about open source technologies and likes to keep abreast with the latest developments in KDE and Ubuntu. He also loves listening to music and is a huge Tegan snd Sara fan. You can follow him on twitter @ricky_lais.