orbit
orbit copied to clipboard
Support cgroup version 2 for memory tracing
trafficstars
Some relevant links: https://www.kernel.org/doc/Documentation/cgroup-v2.txt https://www.kernel.org/doc/Documentation/cgroup-v1/memory.txt https://www.usenix.org/system/files/lisa21_slides_down.pdf
To get the basic information (such as pagefaults), we can do the following:
$cat /proc/%PID%/cgroup
0::/A/B/C/D
$cat /sys/fs/cgroup/A/B/C/D/memory.stat
From there read the fields according to the spec. Note, that this will give use the info of the inner-most cgroup, which might or might not what the user expects. A detailed description is needed.
However, version 2 drops some fields, like rss, which are not yet clear how to retrieve them.
A simple first version could be to start with the pagefault track.