]> www.infradead.org Git - users/hch/misc.git/commit
cgroup: cgroup.stat.local time accounting
authorTiffany Yang <ynaffit@google.com>
Fri, 22 Aug 2025 01:37:52 +0000 (18:37 -0700)
committerTejun Heo <tj@kernel.org>
Fri, 22 Aug 2025 17:50:43 +0000 (07:50 -1000)
commitafa3701c0e45ecb9e4d160048ca4e353c7489948
tree167bba9eec98ce9467b2e1d3aab6a5f67814c9af
parent4c70fb2624ab1588faa58dcd407d4c61d64b288d
cgroup: cgroup.stat.local time accounting

There isn't yet a clear way to identify a set of "lost" time that
everyone (or at least a wider group of users) cares about. However,
users can perform some delay accounting by iterating over components of
interest. This patch allows cgroup v2 freezing time to be one of those
components.

Track the cumulative time that each v2 cgroup spends freezing and expose
it to userland via a new local stat file in cgroupfs. Thank you to
Michal, who provided the ASCII art in the updated documentation.

To access this value:
  $ mkdir /sys/fs/cgroup/test
  $ cat /sys/fs/cgroup/test/cgroup.stat.local
  freeze_time_total 0

Ensure consistent freeze time reads with freeze_seq, a per-cgroup
sequence counter. Writes are serialized using the css_set_lock.

Signed-off-by: Tiffany Yang <ynaffit@google.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Michal Koutný <mkoutny@suse.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Documentation/admin-guide/cgroup-v2.rst
include/linux/cgroup-defs.h
kernel/cgroup/cgroup.c
kernel/cgroup/freezer.c