Legacy v1 ad-hoc cgroup
libcgroup v1 throwaway limit. note: v2 unified hierarchy uses systemd-run --scope -p
cgcreate -g memory:/<name>; cgset -r memory.limit_in_bytes=512M <name>; cgexec -g memory:/<name> <command>
- tool
- cgroups8 commands
More cgroups commands
-
cat /sys/fs/cgroup/system.slice/<name>.service/memory.current /sys/fs/cgroup/system.slice/<name>.service/memory.maxLive RSS vs hard limit for a systemd service; current near max = imminent OOM
-
cat /sys/fs/cgroup/system.slice/<name>.service/memory.pressurePSI: time tasks stalled on memory reclaim; rising avg10 = thrashing before OOM
-
grep -E 'nr_throttled|throttled_usec' /sys/fs/cgroup/system.slice/<name>.service/cpu.statCount and total usec a cgroup was CPU-throttled by cpu.max quota
-
cat /sys/fs/cgroup/system.slice/<name>.service/cpu.max # "max 100000" = unlimited; "50000 100000" = 0.5 corecpu.max is 'quota period' in usec; 'max' = no limit. note: prefer systemctl set-property
-
cat /sys/fs/cgroup/system.slice/<name>.service/io.pressure /sys/fs/cgroup/system.slice/<name>.service/io.statPSI io stall plus per-major:minor rbytes/wbytes/rios; pin noisy disk neighbors