Re: [tip:sched/core] sched/cputime: Ensure accurate utime and stime ratio in cputime_adjust()

From: Ingo Molnar
Date: Mon Jul 16 2018 - 13:41:26 EST



* Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:

> 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.

Sure, I've removed it from sched/core.

Thanks,

Ingo