On Tue, Nov 16, 2010 at 11:56:33AM -0800, Paul Menage wrote:
Yes. And it seems to be working just fine for me. I modiefied Lennart's
script a bit to achieve that.
Addition to my .bashrc.
if [ "$PS1" ] ; then
mkdir -m 0700 -p /cgroup/cpu/$$
echo 1 > /cgroup/cpu/$$/notify_on_release
echo $$ > /cgroup/cpu/$$/tasks
fi
I created one file /bin/rmcgroup to clean up the cgroup.
#!/bin/bash
rmdir /cgroup/cpu/$1
And did following to mount cgroup and setup empty group notification.
mount -t cgroup -o cpu none /cgroup/cpu
echo "/bin/rmcgroup" > /cgroup/cpu/release_agent
And it works fine. Upon ssh to my box, a cpu cgroup is automatically
created and upon exiting the shell, this group is automatically destroyed.
So API/interface for automatically reclaiming the cgroup once it is empty
seems to be pretty simple and works.
Thanks
Vivek
--