Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1698168 > unrolled thread

Re: [PATCH] cgroup: add cgroup.stat interface with basic hierarchy stats

Started byTejun Heo <tj@kernel.org>
First post2017-07-27 18:30 +0200
Last post2017-07-28 17:10 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] cgroup: add cgroup.stat interface with basic hierarchy  stats Tejun Heo <tj@kernel.org> - 2017-07-27 18:30 +0200
    Re: [PATCH] cgroup: add cgroup.stat interface with basic hierarchy  stats Tejun Heo <tj@kernel.org> - 2017-07-28 17:10 +0200

#1698168 — Re: [PATCH] cgroup: add cgroup.stat interface with basic hierarchy stats

FromTejun Heo <tj@kernel.org>
Date2017-07-27 18:30 +0200
SubjectRe: [PATCH] cgroup: add cgroup.stat interface with basic hierarchy stats
Message-ID<u7TPI-8oO-13@gated-at.bofh.it>
Hello,

On Thu, Jul 27, 2017 at 05:14:20PM +0100, Roman Gushchin wrote:
> Add a cgroup.stat interface to the base cgroup control files
> with the following metrics:
> 
> nr_descendants		total number of descendant cgroups
> nr_dying_descendants	total number of dying descendant cgroups
> max_descendant_depth	maximum descent depth below the current cgroup

Yeah, this'd be great to have.  Some comments below.

> +  cgroup.stat
> +	A read-only flat-keyed file with the following entries:
> +
> +	  nr_descendants
> +		Total number of descendant cgroups.
> +
> +	  nr_dying_descendants
> +		Total number of dying descendant cgroups.

Can you please go into more detail on what's going on with dying
descendants here?

> +static int cgroup_stats_show(struct seq_file *seq, void *v)
> +{
> +	struct cgroup_subsys_state *css;
> +	unsigned long total = 0;
> +	unsigned long offline = 0;
> +	int max_level = 0;
> +
> +	rcu_read_lock();
> +	css_for_each_descendant_pre(css, seq_css(seq)) {
> +		if (css == seq_css(seq))
> +			continue;
> +		++total;

Let's do post increment for consistency.

> +		if (!(css->flags & CSS_ONLINE))
> +			++offline;
> +		if (css->cgroup->level > max_level)
> +			max_level = css->cgroup->level;
> +	}
> +	rcu_read_unlock();

I wonder whether we want to keep these counters in sync instead of
trying to gather the number on read.  Walking all descendants can get
expensive pretty quickly and things like nr_descendants will be useful
for other purposes too.

Thanks.

-- 
tejun

[toc] | [next] | [standalone]


#1698876

FromTejun Heo <tj@kernel.org>
Date2017-07-28 17:10 +0200
Message-ID<u8f3Q-5oC-19@gated-at.bofh.it>
In reply to#1698168
Hello,

On Fri, Jul 28, 2017 at 02:01:55PM +0100, Roman Gushchin wrote:
> > > +	  nr_dying_descendants
> > > +		Total number of dying descendant cgroups.
> > 
> > Can you please go into more detail on what's going on with dying
> > descendants here?
>
> Sure.
> Don't we plan do describe cgroup/css lifecycle in details
> in a separate section?

We should but it'd still be nice to have a short description here too.

Thanks.

-- 
tejun

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web