There have been quite a hype about a new 200 lines kernel patch that reportedly greatly improve Ubuntu responsiveness. And then a Red Hat guy pointed out an easy way to achieve the same without patching the kernel itself.
Soon after the Internet hive mind had ported this simple fix to multiple distros. I personally use Ubuntu, so I created a fabfile to update multiple Ubuntu machine at the same time.
To use it you must first install fabric:
$: sudo apt-get install fabric
Then copy paste this code and save it to a file named fabric.pyfabfile.py:
from __future__ import with_statement
import os, sys, re
from fabric.api import *
from fabric.utils import warn
# Can patch multiple hosts: ['localhost', 'email@example.com', 'server.com:2222']
env.hosts = ['localhost',]
CONF_BASHRC = '~/.bashrc'
CONF_CGROUP_CLEAN = '/usr/local/sbin/cgroup_clean'
CONF_RC_LOCAL = '/etc/rc.local'
abort("System already patched.")
sudo("sed -i 's/^exit 0$/\
mkdir -p \/dev\/cgroup\/cpu\\n\
mount -t cgroup cgroup \/dev\/cgroup\/cpu -o cpu\\n\
mkdir -m 0777 \/dev\/cgroup\/cpu\/user\\n\
echo \"1\" > \/dev\/cgroup\/cpu\/user\/notify_on_release\\n\
echo \"\/usr\/local\/sbin\/cgroup_clean\" > \/dev\/cgroup\/cpu\/release_agent\\n\
\\nexit 0/' %s" % CONF_RC_LOCAL)
sudo("chmod +x %s" % CONF_RC_LOCAL)
bashrc = """\
# Ubuntu speed optimization
if [ "$PS1" ] ; then
mkdir -m 0700 /dev/cgroup/cpu/user/$$
echo $$ > /dev/cgroup/cpu/user/$$/tasks
sudo("echo '%s' >> %s" % (bashrc, os.path.expanduser(CONF_BASHRC)))
cgroup_clean = """\
if [ "$1" != "/user" ]; then
sudo("echo '%s' >> %s" % (cgroup_clean, CONF_CGROUP_CLEAN))
sudo("sudo chmod +x %s" % CONF_CGROUP_CLEAN)
print "Done ! You can now restart your computer."
Update: added a small fix for Ubuntu 10.10, thanks to jbus
Update 2: I forgot to mention that since you can patch remote machines, ssh must be installed and activated in order for this script to work. Here's how to install it:
sudo apt-get install ssh
Then while in the folder where fabfile.py is located you can simply run this command:
$: fab patch
You change the env.hosts variable to accommodate multiple remote hosts (fabric must be installed on all of them).
And if you're wondering if the optimization is really worth it, fuck yes. It's worth it enough so I write a script to patch all my machines.
This still only for 32bit 10.10 or can I run it on 64bit also? Thanks. - S
I've tested it on two different 64bit machines without any problems.
Thanks a bundle for this!
How can I verify that the patch is in place? :)
That's how we feel about http://www.sugarsit.com coach handbags outlet by Steven http://www.legacyoutlet.com coach outlet store online shoes. However, the two-and-a-half http://www.chanluustores.com/ hour telecast http://www.ray-banitaly.com/ Ray ban can easily be summed up with these 12 coach outlet. And in a tiny tanktop no less. In addition to his http://www.coachstoreonlinebags.com Vanguard and Best Marc Jacobs Moonmen, http://www.legacyoutlet.com/limited-inventory-coach-outlet-stores-online-sale/ also took home awards for http://www.cocoachfactory.com/ and Best Editing.
At one stage in Coach Outlet Online the evening Coach Outlet I told him I thought Coach Factory Outlet he was the Coach Outlet Online biggest bullartist Coach Factory Outlet I'd ever met,
Fireworks,http://www.mmonsterheadphones.net/, these two words,http://www.guccishoesofactory.com/, let the listeners to look like one, pragmatic appropriateness,Coach Outlet Online, earthly warmth, used to describe the hometown of fireworks town, is the most relevant,Michael Kors States, home town, is a large town in west sichuan plain,North Faces Outlet, there are more than 2000 historical records,North Clearance Outlet Online, is the ancient chinese filial piety, is one big dutiful son han jiang shi's hometown,Louis Vuitton Shop, the legendary one filial piety, and ann send rice,http://www.northefaceoutletonline.net/, story took place here,Michael Kors Outlet, small town,Coach Factory Online, the streets were herringbone, play three angles,Michael Kors Outlet USA, triangles Xiaobazi,Gucci Shoes Factory, grocery shopping place,Coach Factory Outlet, thus,Monster Headphones Outlet, along the narrow,Louis Vuitton Shoes Factory, and winding streets, through the mill,http://www.laurenpoloralph.com/, post office, town, school, studio, theater, red shops, to commune hospitals,Coach Bags Outlet, streets around the bifurcation,Polo Outlet Online, a bonus street,MCM Outlet, a side street inhabited by the hui people,Coach Bags Store Online, all through the end of the rice market to end dam.
If you enter anything in this field your comment will be treated as spam