Tuesday, December 7, 2010

sched: automated per tty task groups

For sure, you already heard about those magic 220 lines
to blow your head off (yes, "[RFC/RFT PATCH v3] sched: automated
per tty task groups").

Lennart Poettering, however, proposed similar solution, yet
without any need to patch your kernel.

I've changed it a bit, since original didn't work for me.
I added those lines to the end of .bashrc:
if [ "$PS1" ] ; then
    mkdir -m 0700 /cgroup/cpu/user/$$
    echo $$ > /cgroup/cpu/user/$$/tasks
fi


and to /etc/rc.local:
mount -t cgroup cgroup /cgroup/cpu -o cpu
mkdir -p -m 0777 /cgroup/cpu/user

Quick test:
ls /cgroup/cpu/user/
11564 1164 15342 24870 28728 3746 3812 ...


Tested while compiling kernel -j16, emacs -j8 and a few
things in the meantime...
Seems to work.

The truth behind the scene is that the kernel is much more
complicated than they told you in books.

P.S.
It may require libcgroup

No comments:

Post a Comment