From: Balaji Rao <balajirrao@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: dhaval@linux.vnet.ibm.com, linux-kernel@vger.kernel.org,
containers@lists.osdl.org, menage@google.com, balbir@in.ibm.com,
vatsa@linux.vnet.ibm.com, a.p.zijlstra@chello.nl,
dada1@cosmosbay.com
Subject: Re: [RFC][-mm] Simple stats for cpu resource controller v4
Date: Tue, 13 May 2008 09:00:27 +0530 [thread overview]
Message-ID: <200805130900.27492.balajirrao@gmail.com> (raw)
In-Reply-To: <20080512164833.8354abeb.akpm@linux-foundation.org>
On Tuesday 13 May 2008 05:18:33 am Andrew Morton wrote:
> On Mon, 12 May 2008 01:48:37 +0530
>
> Balaji Rao <balajirrao@gmail.com> wrote:
> > Hi Andrew,
> >
> > Here's a version that uses percpu_counters and which actually works. The
> > only evil it contains is the check,
> >
> > if (percpu_counter_ready) {
> > ..
> > }
>
> There's no instance of "percpu_counter_ready" in the patch so I'm a bit
> stumped.
>
Here it is. 'stat' can tell us if percpu_counters are ready or not.
+static void __cpu_cgroup_stat_add(struct cpu_cgroup_stat *stat,
+ enum cpu_cgroup_stat_index idx, int val)
+{
+ if (stat)
+ percpu_counter_add(&stat->cpustat[idx], val);
+}
+#endif
It's here as well.
+static s64 cpu_cgroup_read_stat(struct cpu_cgroup_stat *stat,
+ enum cpu_cgroup_stat_index idx)
+{
+ if (stat)
+ return percpu_counter_read(&stat->cpustat[idx]);
+
+ return 0;
+}
+
> > @@ -3837,6 +3858,16 @@ void account_user_time(struct task_struct *p,
> > cputime_t cputime) cpustat->nice = cputime64_add(cpustat->nice, tmp);
> > else
> > cpustat->user = cputime64_add(cpustat->user, tmp);
> > +
> > + /* Charge the task's group */
> > +#ifdef CONFIG_CGROUP_SCHED
> > + {
> > + struct task_group *tg;
> > + tg = task_group(p);
> > + __cpu_cgroup_stat_add(tg->stat, CPU_CGROUP_STAT_UTIME,
> > + cputime_to_msecs(cputime));
> > + }
> > +#endif
> > }
> >
> > /*
> > @@ -3892,8 +3923,17 @@ void account_system_time(struct task_struct *p,
> > int hardirq_offset, cpustat->irq = cputime64_add(cpustat->irq, tmp);
> > else if (softirq_count())
> > cpustat->softirq = cputime64_add(cpustat->softirq, tmp);
> > - else if (p != rq->idle)
> > + else if (p != rq->idle) {
> > cpustat->system = cputime64_add(cpustat->system, tmp);
> > +#ifdef CONFIG_CGROUP_SCHED
> > + {
> > + struct task_group *tg;
> > + tg = task_group(p);
> > + __cpu_cgroup_stat_add(tg->stat, CPU_CGROUP_STAT_STIME,
> > + cputime_to_msecs(cputime));
> > + }
> > + }
> > +#endif
>
> I'd suggest that the above be turned into calls to a helper function
> which is a no-op if !CONFIG_CGROUP_SCHED.
OK. Will do.
--
Warm Regards,
Balaji Rao
Dept. of Mechanical Engineering
NITK
prev parent reply other threads:[~2008-05-13 3:31 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-05 18:09 [RFC][-mm] [1/2] Simple stats for cpu resource controller Balaji Rao
2008-04-05 18:56 ` Dhaval Giani
2008-04-05 19:09 ` Balaji Rao
2008-04-05 19:40 ` Dhaval Giani
2008-04-05 20:31 ` Balaji Rao
2008-04-05 20:59 ` Dhaval Giani
2008-04-05 21:21 ` Balaji Rao
2008-04-06 5:12 ` Balbir Singh
2008-04-07 13:24 ` Peter Zijlstra
2008-04-10 16:09 ` Balaji Rao
2008-04-10 16:25 ` Peter Zijlstra
2008-05-01 17:41 ` [RFC][-mm] Simple stats for cpu resource controller v3 Balaji Rao
2008-05-01 21:00 ` Andrew Morton
2008-05-02 19:40 ` Balaji Rao
2008-05-02 19:53 ` Andrew Morton
2008-05-02 22:47 ` Balaji Rao
2008-05-02 23:04 ` Andrew Morton
[not found] ` <200805030457.54073.balajirrao@gmail.com>
[not found] ` <20080502164133.9025a02c.akpm@linux-foundation.org>
2008-05-02 23:56 ` Balaji Rao
2008-05-03 0:19 ` Andrew Morton
2008-05-11 20:18 ` [RFC][-mm] Simple stats for cpu resource controller v4 Balaji Rao
2008-05-12 2:54 ` Li Zefan
2008-05-12 5:41 ` Balaji Rao
2008-05-12 23:48 ` Andrew Morton
2008-05-13 3:30 ` Balaji 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=200805130900.27492.balajirrao@gmail.com \
--to=balajirrao@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=balbir@in.ibm.com \
--cc=containers@lists.osdl.org \
--cc=dada1@cosmosbay.com \
--cc=dhaval@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=menage@google.com \
--cc=vatsa@linux.vnet.ibm.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
all inboxes | Powered by JetHome®