Thread (36 messages) 36 messages, 4 authors, 2012-05-30

Re: [PATCH v3 3/6] expose fine-grained per-cpu data for cpuacct stats

From: Peter Zijlstra <hidden>
Date: 2012-05-30 10:43:57
Also in: lkml

On Wed, 2012-05-30 at 14:34 +0400, Glauber Costa wrote:
On 05/30/2012 02:34 PM, Peter Zijlstra wrote:
quoted
On Wed, 2012-05-30 at 13:48 +0400, Glauber Costa wrote:
quoted
+static int cpuacct_stats_percpu_show(struct cgroup *cgrp, struct cftype *cft,
+				     struct cgroup_map_cb *cb)
+{
+	struct cpuacct *ca = cgroup_ca(cgrp);
+	int cpu;
+
+	for_each_online_cpu(cpu) {
+		do_fill_cb(cb, ca, "user", cpu, CPUTIME_USER);
+		do_fill_cb(cb, ca, "nice", cpu, CPUTIME_NICE);
+		do_fill_cb(cb, ca, "system", cpu, CPUTIME_SYSTEM);
+		do_fill_cb(cb, ca, "irq", cpu, CPUTIME_IRQ);
+		do_fill_cb(cb, ca, "softirq", cpu, CPUTIME_SOFTIRQ);
+		do_fill_cb(cb, ca, "guest", cpu, CPUTIME_GUEST);
+		do_fill_cb(cb, ca, "guest_nice", cpu, CPUTIME_GUEST_NICE);
+	}
+
+	return 0;
+}
Uhm, hotplug anyone?
What's with hotplug ?

Who's to say all cpus are online at this point? If you don't want to
make the files come and go with hotplug, one should use
for_each_possible_cpu().
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help