How do I check cgroup v2 is installed on my machine?
You could run the following command:
grep cgroup /proc/filesystems
If your system supports cgroupv2, you would see:
nodev cgroup
nodev cgroup2
On a system with only cgroupv1, you would only see:
nodev cgroup
The easiest way is to attempt to mount the pseudo-filesystem. If you can mount it to a location, then you can attempt to manage processes with the interface:
mount -t cgroup2 none $MOUNT_POINT
I see that you cited the documentation above. One of the points you may be missing is that the paths still need to be created. There's no reason you must manage cgroup resources at any particular location. It's just convention.
For example, you could totally present procfs
at /usr/monkeys
... as long as the directory /usr/monkeys
exists:
$ sudo mkdir /usr/monkeys
$ sudo mount -t proc none /usr/monkeys
$ ls -l /usr/monkeys
...
...
-r--r--r--. 1 root root 0 Sep 25 19:00 uptime
-r--r--r--. 1 root root 0 Sep 25 23:17 version
-r--------. 1 root root 0 Sep 25 23:17 vmallocinfo
-r--r--r--. 1 root root 0 Sep 25 18:57 vmstat
-r--r--r--. 1 root root 0 Sep 25 23:17 zoneinfo
$ sudo umount /usr/monkeys
In the same way I can do this with the cgroup v2 pseudo-filesystem:
$ sudo mount -t cgroup2 none /usr/monkeys
$ ls -l /usr/monkeys
total 0
-r--r--r--. 1 root root 0 Sep 23 16:58 cgroup.controllers
-rw-r--r--. 1 root root 0 Sep 23 16:58 cgroup.max.depth
-rw-r--r--. 1 root root 0 Sep 23 16:58 cgroup.max.descendants
-rw-r--r--. 1 root root 0 Sep 23 16:58 cgroup.procs
-r--r--r--. 1 root root 0 Sep 23 16:58 cgroup.stat
-rw-r--r--. 1 root root 0 Sep 23 16:58 cgroup.subtree_control
-rw-r--r--. 1 root root 0 Sep 23 16:58 cgroup.threads
drwxr-xr-x. 2 root root 0 Sep 23 16:58 init.scope
drwxr-xr-x. 2 root root 0 Sep 23 16:58 machine.slice
drwxr-xr-x. 59 root root 0 Sep 23 16:58 system.slice
drwxr-xr-x. 4 root root 0 Sep 23 16:58 user.slice
$ sudo umount /usr/monkeys