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!

Reply via email to