From: Peter Zijlstra <peterz@infradead.org>
To: Xunlei Pang <xlpang@linux.alibaba.com>
Cc: Ingo Molnar <mingo@redhat.com>,
Frederic Weisbecker <frederic@kernel.org>,
Tejun Heo <tj@kernel.org>,
baoyou.xie@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] sched/cputime: Ensure accurate utime and stime ratio in cputime_adjust()
Date: Mon, 16 Jul 2018 15:35:06 +0200 [thread overview]
Message-ID: <20180716133506.GB2494@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20180709145843.126583-1-xlpang@linux.alibaba.com>
On Mon, Jul 09, 2018 at 10:58:43PM +0800, Xunlei Pang wrote:
> If users access "/proc/pid/stat", the utime and stime ratio in the
> current SAMPLE period are excepted, but currently cputime_adjust()
> always calculates with the ratio of the WHOLE lifetime of the process.
>
> This results in inaccurate utime and stime in "/proc/pid/stat". For
> example, a process runs for a while with "50% usr, 0% sys", then
> followed by "100% sys". For later while, the following is excepted:
> 0.0 usr, 100.0 sys
> but we got:
> 10.0 usr, 90.0 sys
>
> This patch uses the accurate ratio in cputime_adjust() to address the
> issue. A new task_cputime type field is added in prev_cputime to record
> previous task_cputime so that we can get the elapsed times as the accurate
> ratio.
This still does not explain anything...
prev parent reply other threads:[~2018-07-16 13:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-09 14:58 [PATCH v2] sched/cputime: Ensure accurate utime and stime ratio in cputime_adjust() Xunlei Pang
2018-07-15 23:36 ` [tip:sched/core] " tip-bot for Xunlei Pang
2018-07-16 13:37 ` Peter Zijlstra
2018-07-16 16:11 ` Frederic Weisbecker
2018-07-16 17:41 ` Ingo Molnar
2018-07-17 4:08 ` Xunlei Pang
2018-07-23 9:21 ` Peter Zijlstra
2018-07-24 13:28 ` Xunlei Pang
2018-07-16 13:35 ` Peter Zijlstra [this message]
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=20180716133506.GB2494@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=baoyou.xie@gmail.com \
--cc=frederic@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tj@kernel.org \
--cc=xlpang@linux.alibaba.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;
as well as URLs for NNTP newsgroup(s).