[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <oel2dyzlyvzggpwxprhwbd7n2ye2bst32izjnzywjdilo4nena@p7bcxgy6lqyq>
Date: Thu, 14 Aug 2025 17:54:44 +0200
From: Michal Koutný <mkoutny@...e.com>
To: Tiffany Yang <ynaffit@...gle.com>
Cc: linux-kernel@...r.kernel.org, John Stultz <jstultz@...gle.com>,
Thomas Gleixner <tglx@...utronix.de>, Stephen Boyd <sboyd@...nel.org>,
Anna-Maria Behnsen <anna-maria@...utronix.de>, Frederic Weisbecker <frederic@...nel.org>,
Tejun Heo <tj@...nel.org>, Johannes Weiner <hannes@...xchg.org>,
"Rafael J. Wysocki" <rafael@...nel.org>, Pavel Machek <pavel@...nel.org>,
Roman Gushchin <roman.gushchin@...ux.dev>, Chen Ridong <chenridong@...wei.com>, kernel-team@...roid.com,
Jonathan Corbet <corbet@....net>, Shuah Khan <shuah@...nel.org>, cgroups@...r.kernel.org,
linux-doc@...r.kernel.org, linux-kselftest@...r.kernel.org
Subject: Re: [RFC PATCH v3 1/2] cgroup: cgroup.freeze.stat.local time
accounting
Hello.
On Mon, Aug 04, 2025 at 08:29:41PM -0700, Tiffany Yang <ynaffit@...gle.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@...e.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
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists