From: Bharata B Rao <bharata@linux.vnet.ibm.com>
To: Li Zefan <lizf@cn.fujitsu.com>
Cc: linux-kernel@vger.kernel.org, Balaji Rao <balajirrao@gmail.com>,
Dhaval Giani <dhaval@linux.vnet.ibm.com>,
Balbir Singh <balbir@linux.vnet.ibm.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: Wed, 11 Mar 2009 14:24:58 +0530 [thread overview]
Message-ID: <20090311085458.GB5592@in.ibm.com> (raw)
In-Reply-To: <49B710C4.8040401@cn.fujitsu.com>
On Wed, Mar 11, 2009 at 09:15:48AM +0800, Li Zefan wrote:
> > +static const struct cpuacct_stat_desc {
> > + const char *msg;
> > + u64 unit;
> > +} cpuacct_stat_desc[] = {
> > + [CPUACCT_STAT_UTIME] = { "utime", 1, },
> > + [CPUACCT_STAT_STIME] = { "stime", 1, },
> > +};
> > +
>
> I think we can just remove 'unit'.
Ok, they are redundant. Will do.
>
> > +static int cpuacct_stats_show(struct cgroup *cgrp, struct cftype *cft,
> > + struct cgroup_map_cb *cb)
> > +{
> > + struct cpuacct *ca = cgroup_ca(cgrp);
> > + int i;
> > +
> > + for (i = 0; i < CPUACCT_STAT_NSTATS; i++) {
> > + s64 val = percpu_counter_read(&ca->cpustat[i]);
> > + val *= cpuacct_stat_desc[i].unit;
> > + cb->fill(cb, cpuacct_stat_desc[i].msg, val);
> > + }
> > + return 0;
> > +}
> > +
> ...
> > +/*
> > + * Account the system/user time to the task's accounting group.
> > + */
> > +static void cpuacct_update_stats(struct task_struct *tsk,
> > + enum cpuacct_stat_index idx, int val)
> > +{
> > + struct cpuacct *ca;
> > +
> > + if (!cpuacct_subsys.active)
>
> if (unlikely(!cpuacct_subsys.active)))
Ok.
>
> > + return;
> > +
> > + ca = task_ca(tsk);
> > +
> > + for (; ca; ca = ca->parent)
> > + percpu_counter_add(&ca->cpustat[idx], val);
> > +}
> > +
>
> We can reduce one NULL check:
>
> do (
> percpu_counter_add();
> ca = ca->parent;
> } while (ca);
Sure. Will address all these in the next iteration.
Regards,
Bharata.
next prev parent reply other threads:[~2009-03-11 8:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-10 12:42 [RFC PATCH] cpuacct: per-cgroup utime/stime statistics - v1 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 [this message]
2009-03-11 15:16 ` Balbir Singh
2009-03-11 16:44 ` Balbir Singh
2009-03-12 4:44 ` Bharata B Rao
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=20090311085458.GB5592@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