fn tightest_cgroup_limit(
self_cgroup: &str,
mountinfo: &str,
read: impl Fn(&Path) -> Option<String>,
) -> Option<u64>Expand description
Returns the tightest memory limit on this process’s cgroups, given the contents of
/proc/self/cgroup and /proc/self/mountinfo.
A service usually runs in a nested cgroup, such as a systemd unit under system.slice, and any
cgroup between it and the root can set the limit that applies. So this checks the process’s
cgroup and every ancestor visible in a mount, under both the cgroup v2 and the v1 memory
hierarchies.