From: Peter Zijlstra <peterz@infradead.org>
To: Zhao Lei <zhaolei@cn.fujitsu.com>
Cc: linux-kernel@vger.kernel.org, Tejun Heo <htejun@gmail.com>,
Yang Dongsheng <yangds.fnst@cn.fujitsu.com>
Subject: Re: [PATCH v3 3/3] cpuacct: split usage into user_usage and sys_usage
Date: Thu, 17 Mar 2016 09:40:02 +0100 [thread overview]
Message-ID: <20160317084002.GN6344@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <5a23ec991c5abf9b62df76be5b081a5fa895f35b.1458187654.git.zhaolei@cn.fujitsu.com>
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!
next prev parent reply other threads:[~2016-03-17 8:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-17 4:19 [PATCH v3 0/3] cpuacct: split usage into user_usage and sys_usage Zhao Lei
2016-03-17 4:19 ` [PATCH v3 1/3] cpuacct: rename parameter in cpuusage_write for readability Zhao Lei
2016-03-17 4:19 ` [PATCH v3 2/3] Some small restruct for cpuacct Zhao Lei
2016-03-21 11:17 ` [tip:sched/urgent] sched/cpuacct: Simplify the cpuacct code tip-bot for Zhao Lei
2016-03-17 4:19 ` [PATCH v3 3/3] cpuacct: split usage into user_usage and sys_usage Zhao Lei
2016-03-17 8:40 ` Peter Zijlstra [this message]
2016-03-17 9:42 ` Zhao Lei
2016-03-17 10:12 ` Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160317084002.GN6344@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=htejun@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=yangds.fnst@cn.fujitsu.com \
--cc=zhaolei@cn.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox