mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Li Zefan <lizf@cn.fujitsu.com>
Cc: Ken Chen <kenchen@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [patch] export percpu cpuacct cgroup stats
Date: Thu, 4 Dec 2008 10:24:54 +0100	[thread overview]
Message-ID: <20081204092454.GK32594@elte.hu> (raw)
In-Reply-To: <49376BE3.1040909@cn.fujitsu.com>


* Li Zefan <lizf@cn.fujitsu.com> wrote:

> (I guess it's more appropriate to ask Ingo to pick up this patch)
> 
> Ken Chen wrote:
> > This patch export per-cpu CPU cycle usage for a given cpuacct cgroup.
> > There is a need for a user space monitor daemon to track group CPU
> > usage on per-cpu base.  It is also useful for monitor CFS load
> > balancer behavior by tracking per CPU group usage.
> > 
> > 
> > Signed-off-by: Ken Chen <kenchen@google.com>
> > 
> > diff --git a/kernel/sched.c b/kernel/sched.c
> > index b7480fb..cd78948 100644
> > --- a/kernel/sched.c
> > +++ b/kernel/sched.c
> > @@ -9345,12 +9345,34 @@ out:
> >  	return err;
> >  }
> > 
> > +static int cpuacct_percpu_seq_read(struct cgroup *cgroup, struct cftype *cft,
> > +				   struct seq_file *m)
> > +{
> > +	struct cpuacct *ca = cgroup_ca(cgroup);
> > +	u64 percpu;
> > +	int i;
> > +
> > +	for_each_possible_cpu(i) {
> > +		spin_lock_irq(&cpu_rq(i)->lock);
> > +		percpu = *percpu_ptr(ca->cpuusage, i);
> > +		spin_unlock_irq(&cpu_rq(i)->lock);
> > +		seq_printf(m, "%lld ", percpu);
> 
> Should be %llu. And if we don't cast percpu to unsigned long long, will 
> it trigger compile warning in some archs?

yes.

> > +	}
> > +	seq_printf(m, "\n");
> > +	return 0;
> > +}
> > +
> >  static struct cftype files[] = {
> >  	{
> >  		.name = "usage",
> >  		.read_u64 = cpuusage_read,
> >  		.write_u64 = cpuusage_write,
> >  	},
> > +	{
> > +		.name = "percpu",
> 
> IMO percpu_usage is a better name.

agreed. Looks good otherwise - will wait for v2 of the patch.

	Ingo

  reply	other threads:[~2008-12-04  9:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-04  4:48 Ken Chen
2008-12-04  5:34 ` Li Zefan
2008-12-04  9:24   ` Ingo Molnar [this message]
2008-12-04 23:02   ` Paul Menage
2008-12-05  7:44     ` Ken Chen
2008-12-05  7:54       ` Li Zefan
2008-12-05  8:30         ` Ken Chen
2008-12-05  8:35           ` Li Zefan
2008-12-05 13:52             ` Ingo Molnar
2008-12-05 18:16               ` Ken Chen
2008-12-07  7:27                 ` Andrew Morton
2008-12-08 14:33                   ` Ingo Molnar
2008-12-05 18:10         ` Ken Chen
2008-12-08  1:25           ` Li Zefan

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=20081204092454.GK32594@elte.hu \
    --to=mingo@elte.hu \
    --cc=akpm@linux-foundation.org \
    --cc=kenchen@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    /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

Powered by JetHome