cgroup user space speed patch

 I recently read an article on OMG Ubuntu about a kernel patch scheduled to land in 2.6.38. There is also a Phoronix article showing video of the speed and responsiveness of the patch. popey then posted on askubuntu.com asking how we include this patch in Ubuntu. A reference there pointed to the two userspace options using cgroups. I have used the second one by Vivek Goyal.

I have tested this on 10.10 (Maverick) x86_64. I am not sure about other releases.

Instructions (italic are the commands to enter or configs to paste)

apt-get install cgroup-bin

Edit /etc/cgconfig.conf

mount {

        cpu = /mnt/cgroups/cpu;
        cpuacct = /mnt/cgroups/cpuacct;
        devices = /mnt/cgroups/devices;
}

group . {
                    perm {
                             task {
                                    uid = root;
                                    gid = adm;
                             }

                             admin {
                                    uid = root;
                                    gid = adm;
                             }
                     }

                     cpu {
                     }
              }

Restart cgconfig

sudo /etc/init.d/cgconfig restart

Add the following to your user .bashrc

if [ "$PS1" ] ; then
        mkdir -m 0700 -p /mnt/cgroups/cpu/$$
        echo 1 > /mnt/cgroups/cpu/$$/notify_on_release
        echo $$ > /mnt/cgroups/cpu/$$/tasks
fi

Create the file /bin/rmcgroup

 #!/bin/bash
rmdir /mnt/cgroups/cpu/$1

Make the file executable

chmod a+x /bin/rmcgroup

As root run

echo "/bin/rmcgroup" > /mnt/cgroups/cpu/release_agent

This will remove the PID on logout. You also may want to put that in /etc/rc.local or in the cgconfig file to be done everytime as its not persistant.

What should happen

Start a new shell (terminal shell is ok) and you should notice in /mnt/cgroups/cpu a directory with a PID of your process. That should be all thats needed according the the posts. Can anyone confirm via benchmark?

 

Comments

I'm going to try this out. It

I'm going to try this out. It would be great to have a package and PPA setup for this.

Wasn't that "userspace

Wasn't that "userspace option" supposed to work only with Systemd?

Installed on ubuntu

Installed on ubuntu 10.04
kernel 2.6.35-22 phc patched (undervolt cpu).
System seems more responsive.

So commands launched from

So commands launched from separate terminals will profit from this. Now there must be a way so i don't need to run mplayer and my browser from two separate terminals, right? .. I'd love to keep my "Applications" menu or to use ALT+F2 and still profit from cgroups.

Office 2007 Home and Student

Office 2007 Home and Student Edition enables you Office 2010 to more assured, more Microsoft Office 2010 secure work.