lkml.org 
[lkml]   [2011]   [Sep]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 2/9] Make cpuacct fields per cpu variables
From
Date
On Wed, 2011-09-14 at 17:04 -0300, Glauber Costa wrote:
> @@ -9258,11 +9253,17 @@ static int cpuacct_stats_show(struct cgroup *cgrp, struct cftype *cft,
> struct cgroup_map_cb *cb)
> {
> struct cpuacct *ca = cgroup_ca(cgrp);
> - int i;
> + int i, cpu;
> + u64 acc[CPUACCT_STAT_NSTATS] = { 0, };
> +
> + for_each_present_cpu(cpu) {
> + u64 *vec = per_cpu_ptr(ca->cpustat, cpu);
> + for (i = 0; i < CPUACCT_STAT_NSTATS; i++)
> + acc[i] += vec[i];
> + }
>
> for (i = 0; i < CPUACCT_STAT_NSTATS; i++) {
> - s64 val = percpu_counter_read(&ca->cpustat[i]);
> - val = cputime64_to_clock_t(val);
> + s64 val = cputime64_to_clock_t(acc[i]);
> cb->fill(cb, cpuacct_stat_desc[i], val);
> }
> return 0;

The changelog doesn't mention this function is a lot more expensive now.

Someone might have daft software polling this frequently.. at least its
still fully preemptible so its not much of a problem, but it is
something to be aware of.


\
 
 \ /
  Last update: 2011-09-19 18:13    [from the cache]
©2003-2011 Jasper Spaans