Cgroups /sys/fs/cgroup is empty on ubuntu
Asked Answered
I

1

9

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!

Incur answered 13/12, 2014 at 2:17 Comment(0)
I
14

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!

Incur answered 15/12, 2014 at 8:0 Comment(1)
Note for future readers: if you're using a distribution with systemd, you don't need to manually mount cgroups as systemd will do it. But not for cpusets; see my question here: unix.stackexchange.com/q/466166/135943Clarkclarke

© 2022 - 2024 — McMap. All rights reserved.