[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200804060201.52726.balajirrao@gmail.com>
Date: Sun, 6 Apr 2008 02:01:52 +0530
From: Balaji Rao <balajirrao@...il.com>
To: Dhaval Giani <dhaval@...ux.vnet.ibm.com>
Cc: linux-kernel@...r.kernel.org, containers@...ts.osdl.org,
menage@...gle.com, a.p.zijlstra@...llo.nl, balbir@...ibm.com,
Srivatsa Vaddagiri <vatsa@...ux.vnet.ibm.com>
Subject: Re: [RFC][-mm] [1/2] Simple stats for cpu resource controller
On Sunday 06 April 2008 01:10:41 am Dhaval Giani wrote:
<snip>
> >
> > +#ifdef CONFIG_CGROUP_SCHED
> > +enum cpu_cgroup_stat_index {
> > + CPU_CGROUP_STAT_UTIME, /* Usertime of the task group */
> > + CPU_CGROUP_STAT_STIME, /* Kerneltime of the task group */
> > +
> > + CPU_CGROUP_STAT_NSTATS,
>
> why the extra space?
Just to keep things clearly separated. If you've not noticed,
CPU_CGROUP_STAT_NSTATS is not a stat.
>
> > +};
> > +
> > +struct cpu_cgroup_stat_cpu {
> > + s64 count[CPU_CGROUP_STAT_NSTATS];
>
> u64? time does not go negative :)
Right. But these stats are not only going to measure time. We need the same
variables for measuring other stats as well. I'm not sure if we would
encounter scheduler stats that would count negative.
Balbir, what do you say ?
> count also is not very clear? Can you give a more descriptive name?
>
ok. How does 'value' look ?
<snip>
> > +static s64 cpu_cgroup_read_stat(struct cpu_cgroup_stat *stat,
> > + enum cpu_cgroup_stat_index idx)
> > +{
> > + int cpu;
> > + s64 ret = 0;
> > + unsigned long flags;
>
> > +
> > + local_irq_save(flags);
>
> I am just wondering. Is local_irq_save() enough?
>
Hmmm.. You are right.This does not prevent concurrent updates on other CPUs
from crossing a 32bit boundary. Am not sure how to do this in a safe way. I
can only think of using atomic64_t now..
> > + for_each_possible_cpu(cpu)
> > + ret += stat->cpustat[cpu].count[idx];
> > + local_irq_restore(flags);
> > +
> > + return ret;
> > +}
> > +
Thanks for the review.
--
regards,
Balaji Rao
Dept. of Mechanical Engineering,
National Institute of Technology Karnataka, India
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists