Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1359629

Re: [PATCH v3 3/3] cpuacct: split usage into user_usage and sys_usage

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH v3 3/3] cpuacct: split usage into user_usage and sys_usage
Date 2016-03-17 09:50 +0100
Message-ID <rdBN0-4Xk-11@gated-at.bofh.it> (permalink)
References <rdxJn-2kC-3@gated-at.bofh.it> <rdxJo-2kC-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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!

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 3/3] cpuacct: split usage into user_usage and sys_usage Zhao Lei <zhaolei@cn.fujitsu.com> - 2016-03-17 05:30 +0100
  Re: [PATCH v3 3/3] cpuacct: split usage into user_usage and sys_usage Peter Zijlstra <peterz@infradead.org> - 2016-03-17 09:50 +0100
    RE: [PATCH v3 3/3] cpuacct: split usage into user_usage and sys_usage Zhao Lei <zhaolei@cn.fujitsu.com> - 2016-03-17 10:50 +0100
      Re: [PATCH v3 3/3] cpuacct: split usage into user_usage and sys_usage Peter Zijlstra <peterz@infradead.org> - 2016-03-17 11:20 +0100

csiph-web