Add cgroup v2 support to coreclr (#34334)
authorJan Vorlicek <janvorli@microsoft.com>
Tue, 7 Apr 2020 09:21:48 +0000 (11:21 +0200)
committerGitHub <noreply@github.com>
Tue, 7 Apr 2020 09:21:48 +0000 (11:21 +0200)
Upstream cgroup v2 documentation is available at:
https://www.kernel.org/doc/Documentation/cgroup-v2.txt

Some notable differences between cgroup v1 and v2, from a coreclr point
of view, include:

- cgroup v2 has a single hierarchy, so we just look for a single "cgroup2"
  entry in /proc/self/mountinfo (without looking for a subsystem match).

- Since cgroup v2 has a single hierarchy, /proc/self/cgroup generally
  has a single line "0::/path". There's no need to match subsystems or
  hierarchy ids here.

- "memory.limit_in_bytes" is now "memory.max". It can contain the
  literal "max" to indicate no limit.

- "memory.usage_in_bytes" is now "memory.current"

- "cpu.cfs_quota_us" and "cpu.cfs_period_us" have been combined into a
  single "cpu.max" file with the format "$MAX $PERIOD". The max value
  can be a literal "max" to indicate a limit is not active.

It is possible to have both cgroup v1 and v2 enabled on a host (but not
inside a container, AFAIK). In that case, this change will pick one
based on /sys/fs/cgroup.


Trivial merge