Re: [PATCH] docs/scheduler: Change unit of cpu_time and rq_time to nanoseconds

From: Matthew Wilcox
Date: Fri Apr 08 2022 - 08:45:55 EST


On Fri, Apr 08, 2022 at 05:31:06PM +0800, brookxu.cn wrote:
> From: Chunguang Xu <brookxu@xxxxxxxxxxx>
>
> In the current implementation, cpu_time and rq_time should be
> in nanoseconds, so this document needs to be modified.

I agree that this is wrong, but we shouldn't be changing the units
of measurement reported to userspace without changing the schedstats
version. I suspect this was an inadvertent change, and we should be
converting from sched_clock() time (~= ns) to jiffies in show_schedstat().
Adding scheduler experts.

> Signed-off-by: Chunguang Xu <brookxu@xxxxxxxxxxx>
> ---
> Documentation/scheduler/sched-stats.rst | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/scheduler/sched-stats.rst b/Documentation/scheduler/sched-stats.rst
> index dd9b99a..9078a27 100644
> --- a/Documentation/scheduler/sched-stats.rst
> +++ b/Documentation/scheduler/sched-stats.rst
> @@ -56,9 +56,9 @@ Next two are try_to_wake_up() statistics:
>
> Next three are statistics describing scheduling latency:
>
> - 7) sum of all time spent running by tasks on this processor (in jiffies)
> + 7) sum of all time spent running by tasks on this processor (in nanoseconds)
> 8) sum of all time spent waiting to run by tasks on this processor (in
> - jiffies)
> + nanoseconds)
> 9) # of timeslices run on this cpu
>
>
> --
> 1.8.3.1
>