Jump to content
Sign in to follow this  
wahaha

unable to enable CPU and CPUSET in cgroup v2

Recommended Posts

hi, i am using cgroup v2 for containerization. however, cgroup v2 is not able to get cpu and cpuset. not sure if this is related to a kernel issue?

cgroup v1 is able to detect it, but i have to use cgroup v2 instead. would be great if you could help

Share this post


Link to post
Share on other sites

I changed the settings to carry on reading from cgroups v1 instead.

I do this by setting this in /boot/cmdline.txt:

systemd.unified_cgroup_hierarchy=0

Share this post


Link to post
Share on other sites

Hi @wahaha

Tinker2 only support cgroup v1.


sudo mkdir -p /sys/fs/cgroup/cpu/testgroup
linaro@linaro-alip:~$ cat /sys/fs/cgroup/cpu/cpu.shares
1024
linaro@linaro-alip:~$ sudo sh -c "echo 256 > /sys/fs/cgroup/cpu/testgroup/cpu.shares"
linaro@linaro-alip:~$ cat /sys/fs/cgroup/cpu/testgroup/cpu.shares
256
linaro@linaro-alip:~$ stressapptest -s 6000 -M 1200
[Before execution] stressapptest CPU loading [58x%]

[Open new Consloe]
linaro@linaro-alip:~$ openssl sha1 < /dev/zero &
linaro@linaro-alip:~$ openssl sha1 < /dev/zero &

[Before execution] stressapptest CPU loading [50x%]
[Before execution] openssl CPU loading [4x%]

linaro@linaro-alip:~$ pgrep stress
954
linaro@linaro-alip:~$ sudo sh -c "echo 954 > /sys/fs/cgroup/cpu/testgroup/cgroup.procs"
linaro@linaro-alip:~$ cat /sys/fs/cgroup/cpu/testgroup/cgroup.procs
954

[After execution] stressapptest CPU loading upto [40x%]
[After execution] openssl CPU loading upto [9x%]
Thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...