From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: Re: [PATCH v3 3/6] expose fine-grained per-cpu data for cpuacct stats Date: Wed, 30 May 2012 12:43:48 +0200 Message-ID: <1338374628.26856.244.camel@twins> References: <1338371317-5980-1-git-send-email-glommer@parallels.com> <1338371317-5980-4-git-send-email-glommer@parallels.com> <1338374041.26856.241.camel@twins> <4FC5F7A0.2000201@parallels.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7BIT Return-path: In-Reply-To: <4FC5F7A0.2000201-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org> Sender: cgroups-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: Content-Type: text/plain; charset="us-ascii" To: Glauber Costa Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, devel-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org, Paul Turner , Tejun Heo , "Eric W. Biederman" , handai.szj-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, Andrew.Phillips-xheW4WVAX9Y@public.gmane.org, Serge Hallyn On Wed, 2012-05-30 at 14:34 +0400, Glauber Costa wrote: > On 05/30/2012 02:34 PM, Peter Zijlstra wrote: > > On Wed, 2012-05-30 at 13:48 +0400, Glauber Costa wrote: > > > >> +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().