[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1316448626.1511.24.camel@twins>
Date: Mon, 19 Sep 2011 18:10:26 +0200
From: Peter Zijlstra <a.p.zijlstra@...llo.nl>
To: Glauber Costa <glommer@...allels.com>
Cc: linux-kernel@...r.kernel.org, xemul@...allels.com,
paul@...lmenage.org, lizf@...fujitsu.com, daniel.lezcano@...e.fr,
mingo@...e.hu, jbottomley@...allels.com
Subject: Re: [PATCH 2/9] Make cpuacct fields per cpu variables
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.
--
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