[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160317084002.GN6344@twins.programming.kicks-ass.net>
Date: Thu, 17 Mar 2016 09:40:02 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Zhao Lei <zhaolei@...fujitsu.com>
Cc: linux-kernel@...r.kernel.org, Tejun Heo <htejun@...il.com>,
Yang Dongsheng <yangds.fnst@...fujitsu.com>
Subject: Re: [PATCH v3 3/3] cpuacct: split usage into user_usage and sys_usage
On Thu, Mar 17, 2016 at 12:19:44PM +0800, Zhao Lei wrote:
> +static u64 __cpuusage_read(struct cgroup_subsys_state *css,
> + enum cpuacct_usage_index index)
> {
> struct cpuacct *ca = css_ca(css);
> u64 totalcpuusage = 0;
> int i;
>
> for_each_present_cpu(i)
> + totalcpuusage += cpuacct_cpuusage_read(ca, i, index);
>
> return totalcpuusage;
> }
Ok, so while looking over this, it mostly uses for_each_present_cpu(),
which is already dubious, but then cpuacct_stats_show() uses
for_each_online_cpu().
Why is this? Why not always for_each_possible_cpu()?
Surely, if you offline a cpu, you still want its stat to be included in
your totals, otherwise your numbers will go backwards when you take a
cpu offline.
Could you double check the logic and maybe fix?
Thanks!
Powered by blists - more mailing lists