Re: [tip:sched/core] sched/cputime: Ensure accurate utime and stime ratio in cputime_adjust()
From: Peter Zijlstra
Date: Mon Jul 16 2018 - 09:38:01 EST
On Sun, Jul 15, 2018 at 04:36:17PM -0700, tip-bot for Xunlei Pang wrote:
> Commit-ID: 8d4c00dc38a8aa30dae8402955e55e7b34e74bc8
> Gitweb: https://git.kernel.org/tip/8d4c00dc38a8aa30dae8402955e55e7b34e74bc8
> Author: Xunlei Pang <xlpang@xxxxxxxxxxxxxxxxx>
> AuthorDate: Mon, 9 Jul 2018 22:58:43 +0800
> Committer: Ingo Molnar <mingo@xxxxxxxxxx>
> CommitDate: Mon, 16 Jul 2018 00:28:31 +0200
>
> sched/cputime: Ensure accurate utime and stime ratio in cputime_adjust()
>
> 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 get:
>
> 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.
Ingo, please make this one go away. I still have no idae what the
problem is and I've not had time to reverse engineer the patch.
The previous (v1) Changelog was a pile of incoherent rambling and the
above doesn't explain anything much.
I want a clear description of the problem and a coherent explanation of
the proposed solution without having to reverse engineer the actual
patch.