Legacy v1 ad-hoc cgroup cgroups
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>
more cgroups
all 8 commands →
Service memory accounting (cgroup v2)
cat /sys/fs/cgroup/system.slice/<name>.service/memory.current /sys/fs/cgroup/system.slice/<name>.service/memory.max
Memory PSI pressure stall
cat /sys/fs/cgroup/system.slice/<name>.service/memory.pressure
CPU throttling stats (cgroup v2)
grep -E 'nr_throttled|throttled_usec' /sys/fs/cgroup/system.slice/<name>.service/cpu.stat
Read and set CPU quota (cgroup v2)
cat /sys/fs/cgroup/system.slice/<name>.service/cpu.max # "max 100000" = unlimited; "50000 100000" = 0.5 core
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