main: Add support for cgroup v2
Support for cgroup v2 is very similar to cgroup v1 just checking (and
writing) different file.
Testing this feature is a bit harder than with cgroup v1 so it's
probably worh noting in this commit message.
- Copy some service file (I've used httpd service) and set CPUQuota=30% in the [service] section.
- Check /sys/fs/cgroup/cgroup.subtree_control - there should be no "cpu"
- Start modified service
- Check /sys/fs/cgroup/cgroup.subtree_control - there should be "cpu"
- Start corosync - It should be able to get rt priority
When move_to_root_cgroup is disabled, behavior differs:
- If corosync is started before modified service, so there is no "cpu" in /sys/fs/cgroup/cgroup.subtree_control corosync starts without problem and gets rt priority. Starting modified service later will never add "cpu" into /sys/fs/cgroup/cgroup.subtree_control (because corosync is holding rt priority and it is placed in the non-root cgroup by systemd).
- When corosync is started after modified service, so "cpu" is in /sys/fs/cgroup/cgroup.subtree_control, corosync is not able to get RT priority.
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>