lkml.org 
[lkml]   [2009]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFC PATCH] cpuacct: per-cgroup utime/stime statistics - v1
    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.


    \
     
     \ /
      Last update: 2009-03-12 05:47    [W:0.034 / U:89.544 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site