[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240711134927.GB456706@cmpxchg.org>
Date: Thu, 11 Jul 2024 09:49:27 -0400
From: Johannes Weiner <hannes@...xchg.org>
To: Waiman Long <longman@...hat.com>
Cc: Tejun Heo <tj@...nel.org>, Zefan Li <lizefan.x@...edance.com>,
Jonathan Corbet <corbet@....net>, cgroups@...r.kernel.org,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
Kamalesh Babulal <kamalesh.babulal@...cle.com>,
Roman Gushchin <roman.gushchin@...ux.dev>
Subject: Re: [PATCH v3 1/2] cgroup: Show # of subsystem CSSes in cgroup.stat
On Wed, Jul 10, 2024 at 02:23:52PM -0400, Waiman Long wrote:
> @@ -3669,12 +3669,34 @@ static int cgroup_events_show(struct seq_file *seq, void *v)
> static int cgroup_stat_show(struct seq_file *seq, void *v)
> {
> struct cgroup *cgroup = seq_css(seq)->cgroup;
> + struct cgroup_subsys_state *css;
> + int ssid;
>
> + /* cgroup_mutex required for for_each_css() */
> + cgroup_lock();
> seq_printf(seq, "nr_descendants %d\n",
> cgroup->nr_descendants);
> seq_printf(seq, "nr_dying_descendants %d\n",
> cgroup->nr_dying_descendants);
>
> + /*
> + * Show the number of live and dying csses associated with each of
> + * non-inhibited cgroup subsystems bound to cgroup v2 if non-zero.
> + */
> + for_each_css(css, ssid, cgroup) {
> + if ((BIT(ssid) & cgrp_dfl_inhibit_ss_mask) ||
> + (cgroup_subsys[ssid]->root != &cgrp_dfl_root))
> + continue;
> +
> + seq_printf(seq, "nr_%s %d\n", cgroup_subsys[ssid]->name,
> + css->nr_descendants + 1);
> + /* Current css is online */
> + if (css->nr_dying_descendants)
> + seq_printf(seq, "nr_dying_%s %d\n",
> + cgroup_subsys[ssid]->name,
> + css->nr_dying_descendants);
> + }
I think it'd be better to print the dying count unconditionally. It
makes the output more predictable for parsers, and also it's clearer
to users which data points are being tracked and reported.
With that, and TJ's "subsys" suggestion for the name, it looks good to
me. Thanks!
Powered by blists - more mailing lists