To make a long story short, a few days ago one of the kernel developers uploaded a patch (200 lines of code) that allowed to improve considerably (almost 10 times) the performance of the system, especially when dealing with multitasking during the execution of a heavy task (such as compiling the kernel). Linus congratulated this developer for his great contribution. However, a Red Hat developer, Lennar Poettering did not agree to implement this enhancement directly from the kernel; it was better for him to make the changes in the user space (~ / .bashrc). Linus got angry and berated this developer, telling him that the results spoke for themselves. Lennar, instead of answering in harsh words, sat down and devised an alternative (that does not need to patch the kernel) and that occupies only 4 lines. Ultimately, they shut up Linus ... |
Note: this method requires support for groups of tasks in the Linux Kernel (cgroups), that is, only users with Kernel higher than 2.6.36 could apply it.
How to apply the patch in Fedora
1.- Edit the ~ / .bashrc file.
gedit ~ / .bashrc
2.- Paste the following code at the end of the file:
if ["$ PS1"]; then
mkdir -m 0700 / sys / fs / cgroup / cpu / user / $$
echo $$> / sys / fs / cgroup / cpu / user / $$ / tasks
fi
3.- Run the following commands:
mount -t cgroup cgroup / sys / fs / cgroup / cpu -o cpu
mkdir -m 0777 / sys / fs / cgroup / cpu / user
How to apply the patch in Ubuntu
In Ubuntu things are a little more complicated ...
1.- Edit the file rc.local with this command:
sudo gedit /etc/rc.local
and paste before where it says "exit 0", the following:
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
2.- Save the file and give it execute permissions:
sudo chmod + x /etc/rc.local
3.- Edit the file ~/.bashrc:
gedit ~ / .bashrc
4.- Paste the following code at the end of the file:
if ["$ PS1"];
then mkdir -m 0700 / dev / cgroup / cpu / user / $$
echo $$> / dev / cgroup / cpu / user / $$ / tasks
echo "1"> / dev / cgroup / cpu / user / $$ / notify_on_release
fi
5.- Modify the cgroup_clean file:
sudo gedit / usr / local / sbin / cgroup_clean
6.- Paste the following code at the end of the file:
#! / Bin / sh
if ["$ *"! = "/ user"]; then
rmdir / dev / cgroup / cpu / $ *
fi
7.- Save the file and give it execute permissions:
sudo chmod + x / usr / local / sbin / cgroup_clean
8.- Reboot the system.
Note: if you see the / dev / cgroup / folder, you will notice a considerable improvement in multitasking management.
I found the instructions for Arch, they are here: http://pastebin.com/raw.php?i=sHRYRuAN
For my part, I applied the patch, much improvement I do not notice in general, but if you notice a big change when scrolling the web pages, they are really fluid for the first time !!! =)
Great! Thank you very much for sharing!
Did I tell you that we are looking for people who use Arch to blog? If you are interested, write to let's uselinux@gmail.com
A big hug! Paul.
Thanks for the invitation, then we will continue by mail then 😉
By chance there will be no instructions for Archlinux, right? 🙂
I did not found them. But something tells me that it sure is more like Fedora. On the other hand, it should be borne in mind that as everyone is assembling Arch as they want, perhaps that influences the procedure to be followed ...
Here I found how to apply them in Archlinux, it is quite similar to fedora: http://pastebin.com/raw.php?i=sHRYRuAN
bash: / dev / cgroup / cpu / user / $ / tasks: The file or directory does not exist
I followed these instructions and it keeps telling me this error when opening terminal AMD64 x if it has something to do
I've already found it, please pablo correct it http://www.webupd8.org/2010/11/alternative-to-200-lines-kernel-patch.html
What to do in ubuntu - instead of what you put - is:
sudo gedit / usr / local / sbin / cgroup_clean
and put this:
#! / Bin / sh
if ["$ *"! = "/ user"]; then
rmdir / dev / cgroup / cpu / $ *
fi
Ready! Corrected! Thank you!
It is true! Thanks for reminding me!
I just added that clarification at the beginning of the post.
A hug! Paul.
Specifically, what benefits will I get as a user, and what performance improvements will be seen in my system.
Everything is going much faster. However, the differences are really "seen" when you are doing a heavy task and want to do other tasks at the same time. For example, you are running the installation of several programs or you are compiling the kernel or editing a heavy video and at the same time you want to surf the internet or watch a movie, etc.
Let me know if you find out how to implement the patch in Arch. I would try running the one that works in Fedora.
Hug! Paul.
I guess that depends on how you use your computer. If you barely use the internet and some light text editor ... you won't "feel" the difference. On the other hand, if you are like me and do heavy tasks (such as converting videos, compiling the kernel, etc.) while browsing the Internet or watching movies, you can tell the difference.
After all the steps, when I open the terminal I always get the following:
mkdir: Cannot create directory "/ dev / cgroup / cpu / user / 1844": File or directory does not exist
bash: / dev / cgroup / cpu / user / 1844 / tasks: The file or directory does not exist
bash: / dev / cgroup / cpu / user / 1844 / notify_on_release: The file or directory does not exist
domingopv @ pc1: ~ $
Everything works fine even the terminal, did you do something wrong?
Mmmm ... I really don't know what it can be. However, I get the impression that it is very likely that you have not done well some of the steps, from 5 onwards especially. Try repeating them or making sure you got them right. That's all I can think of for now.
A big hug! Paul.
Reinstall maverick and reinstall the patch and now I get the following.
mkdir: Cannot create directory "/ dev / cgroup / cpu / user / 1678": File or directory does not exist
bash: / dev / cgroup / cpu / user / 1678 / tasks: The file or directory does not exist
bash: / dev / cgroup / cpu / user / 1678 / notify_on_release: The file or directory does not exist
domingopv @ pc1: ~ $
Uyy .. I really don't know what it can be. It worked perfect for me.
Something tells me that cgroup cleanup is not performing well. That's why I insisted you see from step 5 onwards.
Cheers! Paul.
Mother of mine, impressive, I can see 1080p flash videos on a passive nvidia 8400, I mean, bad bad, PERFECTLY, the cpus all working, wonderful uffff, that improves, it is much better, I have Ubuntu 10.04 😀 good, the videos are good for me hahaha 😀
What rc.local? There are several, which is it? Regards.
I just wrote the commands listed in point 4. You don't have to copy that into a file but run those commands.
Cheers! Paul.
It is poorly explained.
What you have to do is edit the rc.local file with:
sudo gedit /etc/rc.local
You have to paste inside (before exit 0):
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
That's the problem. Those steps are poorly explained.
You are right! It clearly says, "edit the rc.local file." What was missing to add is the command to do such a thing (which some may not know about). I add it right now.
Thanks for the notice! Cheers! Paul.
What would be the procedure in PCLinuxOs?
The truth is I do not know…
If you find out, don't forget to share the data with the rest!
Thank you very much!
Cheers! Paul.
It seems to me or you have not put any reference from where you got it? Could you tell me the source?
Thank you
There is no single source. I was looking for how to do it from different sources and from my own personal experience. In general terms, I can tell you that the sources are the millions of blogs that reproduced that news. Search for "patch 200 linux kernel lines" and you'll see what I'm talking about. I don't remember exactly, but the Ubuntu part may have been obtained from WebUpd8; not so that of Fedora.
I am a user of not long ago, of Ubuntu 64 bit and when I see this tip I start to investigate and the current kernel that I have is 2.6.32-27 according to the post, this patch can only be applied to kernels that are higher or equal to 2.6.36 My question is if this change only works for 32 bit distros or in my current distro can the kernel be updated to 2.6.36?
Thanks for all the info on the web, excellent material.
This change works for 32 and 64 bit, alike.
Cheers! Paul.
to a question, and this would not mess with any later update?
If it didn't go well, what would be the worst that could happen?
(You see that then just going from an Ubuntu 10.04 to a 10.10 crashes everything)
The first thing that should be clarified (to avoid the irresponsible use of the method) is that it requires support for groups of tasks in the Linux Kernel (cgroups), that is, only users with Kernel greater than 2.6.36 could apply this method of improvement.