Read and set CPU quota (cgroup v2) cgroups
cpu.max is 'quota period' in usec; 'max' = no limit. note: prefer systemctl set-property
cat /sys/fs/cgroup/system.slice/<name>.service/cpu.max # "max 100000" = unlimited; "50000 100000" = 0.5 core
more cgroups
all 8 commands →
Per-device IO pressure and stats
cat /sys/fs/cgroup/system.slice/<name>.service/io.pressure /sys/fs/cgroup/system.slice/<name>.service/io.stat
List PIDs in a service cgroup
cat /sys/fs/cgroup/system.slice/<name>.service/cgroup.procs; systemctl status <name>.service | grep CGroup
Full cgroup tree with empty groups
systemd-cgls --all --no-pager; systemd-cgtop -d 2 --depth=3
Legacy v1 ad-hoc cgroup
cgcreate -g memory:/<name>; cgset -r memory.limit_in_bytes=512M <name>; cgexec -g memory:/<name> <command>
Service memory accounting (cgroup v2)
cat /sys/fs/cgroup/system.slice/<name>.service/memory.current /sys/fs/cgroup/system.slice/<name>.service/memory.max