Good start, but let's move this discussion public.
On Tue, Aug 23, 2011 at 3:13 PM, Daniel Lezcano daniel.lezcano@linaro.org wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi all,
I did the following cpuset configuration:
if [ ! -d /sys/fs/cgroup ]; then echo "cgroup not supported by the kernel" else mount -t cgroup cgroup /sys/fs/cgroup
# needed to have the cgroup values inherited from # the parent cgroup echo 1 > /sys/fs/cgroup/cgroup.clone_children
# create an empty cgroup 'cpu0' mkdir /sys/fs/cgroup/cpu0
# create an empty cgroup 'cpu1' mkdir /sys/fs/cgroup/cpu1
# assign cpu number '0' for cgroup cpu0 echo 0 > /sys/fs/cgroup/cpu0/cpuset.cpus
# move outself to this new cgroup echo $$ > /sys/fs/cgroup/cpu0
# move all the tasks to the cpu0 cgroup # kernel threads won't be moved, don't worry about the # the errors. for i in $(cat /sys/fs/cgroup/tasks); do echo $i > /sys/fs/cgroup/cpu0/tasks || echo "failed to add pid $i/$(cat /proc/$i/comm)" done
# assign a cpu for cgroup cpu1 echo 1 > /sys/fs/cgroup/cpu1/cpuset.cpus
# make cpu1 exclusive so processes belonging # to the other cgroups won't be able to use it. echo 1 > /sys/fs/cgroup/cpu1/cpuset.cpu_exclusive fi
At this point, most of the processes have been moved to the 'cpu0' cgroup and will use the cpu0 only. That does not prevent the cpu1 to be used by the kernel threads. Any application launched will run on cpu0 only.
After running 10 infinite loops, the cpu accounting gives:
cat /sys/fs/cgroup/cpu0/cpuacct.usage_percpu 418943579549 0
cat /sys/fs/cgroup/cpu1/cpuacct.usage_percpu 0 0
But the system is:
cat /sys/fs/cgroup/cpuacct.usage_percpu 456741213041 30734572583
My guess is that reflects the kernel booted with the two cpus before we created the cgroup. I am investigation the 'isolcpus' kernel parameter.
I think it is a good starting point to do some consumption measurements.
Mike, Vincent, what do you think ? Do you need more informations or anything else ?
Thanks -- Daniel