Hello.
On Mon, Aug 04, 2025 at 08:29:41PM -0700, Tiffany Yang ynaffit@google.com wrote:
- cgroup.freeze.stat.local
- A read-only flat-keyed file which exists in non-root cgroups.
- The following entry is defined:
freeze_time_total
Cumulative time that this cgroup has spent between freezing and
thawing, regardless of whether by self or ancestor groups.
NB: (not) reaching "frozen" state is not accounted here.
Using the following ASCII representation of a cgroup's freezer
state, ::
1 _____
frozen 0 __/ \__
ab cd
.. Originally contributed by Michal Koutný <mkoutny@suse.com>
the duration being measured is the span between a and c.
This is so little "artwork" that a mere mention in commit message is OK ;-)
+static int cgroup_freeze_local_stat_show(struct seq_file *seq, void *v) +{
- struct cgroup *cgrp = seq_css(seq)->cgroup;
- unsigned int sequence;
- u64 freeze_time;
- do {
sequence = read_seqcount_begin(&cgrp->freezer.freeze_seq);
freeze_time = cgrp->freezer.freeze_time_total_ns;
/* Add in current freezer interval if the task is now frozen */
Nit: cgrp is frozen, not a task here
@@ -179,10 +179,16 @@ static void cgroup_do_freeze(struct cgroup *cgrp, bool freeze) lockdep_assert_held(&cgroup_mutex); spin_lock_irq(&css_set_lock);
- if (freeze)
- write_seqcount_begin(&cgrp->freezer.freeze_seq);
- if (freeze) { set_bit(CGRP_FREEZE, &cgrp->flags);
- else
cgrp->freezer.freeze_time_start_ns = ktime_get_ns();
I wonder whether it wouldn't achieve more stable results if the reference timestamp was taken only once in cgroup_freeze(). Measuring the rate of cgroup traversal is rather noise in this case.
Thanks, Michal