Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cgroups /sys/fs/cgroup is empty on ubuntu

Tags:

ubuntu

cgroups

I am new to cgroup. I want to use cgroup to bind Qemu to some CPUs. I am working on Ubuntu 12.04.3 with my own compiled kernel 3.11.0+.
Below is some output of my commands.

root@xiao-laptop:~/tamlok# service cgconfig start
start: Job failed to start
root@xiao-laptop:~/tamlok# ls /sys/fs/cgroup/
root@xiao-laptop:~/tamlok# cat /proc/mounts | grep cgroup
root@xiao-laptop:~/tamlok# lssubsys --al
cpuset
cpu
cpuacct
devices
freezer
blkio
perf_event

/sys/fs/cgroup/ being empty really confused me. I don't know what should I do next to achieve my target. It seems that the cgroup is not mounted? So what's wrong with this? If you need any info about my platform to solve it, please let me know.

Actually I didn't know the whole process to config and use the cgroup. Or you could help me out with this step by step. I am afraid that lacking some necessary configuration before resulted in this problem. Thanks very much!

like image 833
tamlok Avatar asked Dec 13 '14 02:12

tamlok


1 Answers

Finally, I read the kernel documentation about cgroups and cpusets, and there is a detail description about how to create and use cgroups step by step.
The problem here was that I didn't mount the cgroups. The solution is given below.

mount -t tmpfs cgroup_root /sys/fs/cgroup
mkdir /sys/fs/cgroup/cpuset
mount -t cgroup cpuset -o cpuset /sys/fs/cgroup/cpuset/

Then we can see a cpuset directory and there are files inside to modify the properties of the cpuset.
Thanks very much! Hope this will help someone!

like image 99
tamlok Avatar answered Sep 17 '22 22:09

tamlok