mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bharata B Rao <bharata@linux.vnet.ibm.com>
To: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: linux-kernel@vger.kernel.org, Balaji Rao <balajirrao@gmail.com>,
	Dhaval Giani <dhaval@linux.vnet.ibm.com>,
	Li Zefan <lizf@cn.fujitsu.com>, Paul Menage <menage@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Subject: Re: [RFC PATCH] cpuacct: per-cgroup utime/stime statistics - v1
Date: Thu, 12 Mar 2009 10:14:39 +0530	[thread overview]
Message-ID: <20090312044439.GB3344@in.ibm.com> (raw)
In-Reply-To: <20090311151657.GA16769@balbir.in.ibm.com>

On Wed, Mar 11, 2009 at 08:46:57PM +0530, Balbir Singh wrote:
> * Bharata B Rao <bharata@linux.vnet.ibm.com> [2009-03-10 18:12:08]:
> 
> Hi, Bharata,
> 
> I did a quick run of the patch on my machine. The patch applied and
> compile cleanly, here are a few comments?
> 
> 1. We could consider enhancing the patch to account for irq, softirq,
> etc time like cpustat does. Not right away, but iteratively

Yes that should not be a problem. We can add those easily if needed.

> 2. The accounting is converted to milliseconds, I would much rather
> export it in cputime to be consistent with other cpu accounting.
> I remember we used to return nanosecond accurate accounting and then
> moved to cputime based accounting for cpuacct.

Ok had thought about it but was hesitant to do because that makes
percpu_counters to work directly on cputime_t type. But I guess that is fine.

> 3. How do we deal with CPU hotplug. Since we use a per-cpu counter,
> any hotplug would mean that the data related to the offlined CPU is
> lost. That is how the current CPU accounting system seems to work.

Not a problem as percpu_counter handles hotplug events as you noted
in the other thread.

> > 
> > @@ -9462,20 +9479,33 @@ static struct cgroup_subsys_state *cpuac
> >  	struct cgroup_subsys *ss, struct cgroup *cgrp)
> >  {
> >  	struct cpuacct *ca = kzalloc(sizeof(*ca), GFP_KERNEL);
> > +	int i;
> > 
> >  	if (!ca)
> > -		return ERR_PTR(-ENOMEM);
> > +		goto out1;
> > 
> >  	ca->cpuusage = alloc_percpu(u64);
> > -	if (!ca->cpuusage) {
> > -		kfree(ca);
> > -		return ERR_PTR(-ENOMEM);
> > -	}
> > +	if (!ca->cpuusage)
> > +		goto out2;
> > +
> > +	for (i = 0; i < CPUACCT_STAT_NSTATS; i++)
> > +		if (percpu_counter_init(&ca->cpustat[i], 0))
> > +			goto out3;
> > 
> >  	if (cgrp->parent)
> >  		ca->parent = cgroup_ca(cgrp->parent);
> > 
> >  	return &ca->css;
> > +
> > +out3:
> > +	i--;
> > +	while (i-- >= 0)
> > +		percpu_counter_destroy(&ca->cpustat[i]);
> > +	free_percpu(ca->cpuusage);
> > +out2:
> > +	kfree(ca);
> > +out1:
> > +	return ERR_PTR(-ENOMEM);
> >  }
> >
> 
> Don't like out* as labels, please let us have more meaningful labels.

Ok, I can change them if you don't like out* labels :)

Regards,
Bharata.

      parent reply	other threads:[~2009-03-12  4:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-10 12:42 Bharata B Rao
2009-03-11  0:38 ` KAMEZAWA Hiroyuki
2009-03-11  8:53   ` Bharata B Rao
2009-03-11  9:13     ` KAMEZAWA Hiroyuki
2009-03-11 15:34   ` Balbir Singh
2009-03-12  0:14     ` KAMEZAWA Hiroyuki
2009-03-12  4:29     ` Bharata B Rao
2009-03-12  4:35       ` Balbir Singh
2009-03-11  1:15 ` Li Zefan
2009-03-11  8:54   ` Bharata B Rao
2009-03-11 15:16 ` Balbir Singh
2009-03-11 16:44   ` Balbir Singh
2009-03-12  4:44   ` Bharata B Rao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090312044439.GB3344@in.ibm.com \
    --to=bharata@linux.vnet.ibm.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=balajirrao@gmail.com \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=dhaval@linux.vnet.ibm.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=menage@google.com \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®