Re: [PATCH 5/8] cgroup: rstat: punt root-level optimization to individual controllers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

On Mon, Feb 08, 2021 at 03:29:21PM -0500, Johannes Weiner wrote:
> > > @@ -789,6 +793,7 @@ static void blkcg_rstat_flush(struct cgroup_subsys_state *css, int cpu)
> > >  		u64_stats_update_end(&blkg->iostat.sync);
> > >  
> > >  		/* propagate global delta to parent */
> > > +		/* XXX: could skip this if parent is root */
> > >  		if (parent) {
> > >  			u64_stats_update_begin(&parent->iostat.sync);
> > >  			blkg_iostat_set(&delta, &blkg->iostat.cur);
> > 
> > Might as well update this similar to cgroup_base_stat_flush()?
> 
> I meant to revisit that, but I'm never 100% confident when it comes to
> the interaction and lifetime of css, blkcg and blkg_gq.

Yeah, it does get hairy.

> IIUC, the blkg_gq->parent linkage always matches the css parent
> linkage; it just exists as an optimization for ancestor walks, which
> would otherwise have to do radix lookups when going through the css.

But yes, at least this part is straight-forward.

> So with the cgroup_parent() check at the beginning of the function
> making sure we're looking at a non-root group, blkg_gq->parent should
> also never be NULL and I can do if (paren->parent) directly, right?

I think so.

> > >  static void cgroup_base_stat_flush(struct cgroup *cgrp, int cpu)
> > >  {
> > > -	struct cgroup *parent = cgroup_parent(cgrp);
> > >  	struct cgroup_rstat_cpu *rstatc = cgroup_rstat_cpu(cgrp, cpu);
> > > +	struct cgroup *parent = cgroup_parent(cgrp);
> > 
> > Is this chunk intentional?
> 
> Yeah, it puts the local variable declarations into reverse christmas
> tree ordering to make them a bit easier to read. It's a while-at-it
> cleanup, mostly a force of habit. I can drop it if it bothers you.

I don't mind either way. Was just wondering whether it was accidental.

Thanks.

-- 
tejun




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux