Re: [PATCH] cgroup: Add cgroupstats numbers to cgroup.stat file

From: Tejun Heo
Date: Mon Sep 21 2020 - 10:50:21 EST


Hello,

On Tue, Sep 15, 2020 at 11:53:49PM +0800, Chengming Zhou wrote:
> In the cgroup v1, we can use netlink interface to get cgroupstats for
> a cgroup. But it has been excluded from cgroup v2 interface intentionally
> due to the duplication and inconsistencies with other statistics.
> To make container monitor tool like "cadvisor" continue to work, we add
> these cgroupstats numbers to the cgroup.stat file, and change the
> admin-guide doc accordingly.

So, we can't add O(nr_threads) operations to cgroup.stat reads. There are
two ways forward that I can see.

* Investigate how these counters are being used. If it's used for congestion
detection, pressure metrics are likely better indicators to use anyway. If
the usage frequency is low enough, maybe querying from userspace should
work?

* If the need for these per-cgroup task state counters is really
justifiable, the counters should be maintained from scheduling event
directly and summed up using rstat like other statistics.

Thanks.

--
tejun