docs/scheduler: Change unit of cpu_time and rq_time to nanoseconds
PATCH 1/1 docs/scheduler: Change unit of cpu_time and rq_time to nanoseconds
From: Chunguang Xu <[email protected]>
In the current implementation, cpu_time and rq_time should be in nanoseconds, so this document needs to be modified.
--- Documentation/scheduler/sched-stats.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/scheduler/sched-stats.rst +2 -2
@@ -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
Signature · 1 line
1.8.3.1
Quoted 4 lines · brookxu.cn
From: Chunguang Xu <[email protected]>
In the current implementation,
cpu_timeandrq_timeshould 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.
Quoted 24 lines
Signed-off-by Chunguang Xu <[email protected]>--- Documentation/scheduler/sched-stats.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Documentation/scheduler/sched-stats.rst +2
-2@@ -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 cpuSignature · 1 line
1.8.3.1
Quoted 11 lines · Matthew Wilcox
Quoted 4 lines · brookxu.cn
From: Chunguang Xu <[email protected]>
In the current implementation,
cpu_timeandrq_timeshould 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 inshow_schedstat(). Adding scheduler experts.
Seems to have happend at 425e0968a25f ("sched: move code into kernel/sched_stats.h").
Before that we have:
-static inline void
-rq_sched_info_depart(struct rq *rq, unsigned long delta_jiffies) -{
- if (rq)
- rq->rq_sched_info.cpu_time += delta_jiffies;
-}
-static inline void sched_info_depart(struct task_struct *t) -{
- unsigned long delta_jiffies = jiffies - t->sched_info.last_arrival;
-
- t->sched_info.cpu_time += delta_jiffies;
- rq_sched_info_depart(task_rq(t), delta_jiffies);
-}
afterwards we have:
+static inline void sched_info_depart(struct task_struct *t) +{
+ unsigned long long delta = sched_clock() - t->sched_info.last_arrival;
+
+ t->sched_info.cpu_time += delta;
+ rq_sched_info_depart(task_rq(t), delta);
+}
And that's 15 years and at least one SCHEDSTAT_VERSION ago (although this change itself didn't bump the version).
So I'm thinking we can update the documentation and forget about this.
Jonathan Corbet
maintainerQuoted 4 lines · Peter Zijlstra
And that's 15 years and at least one
SCHEDSTAT_VERSIONago (although this change itself didn't bump the version).So I'm thinking we can update the documentation and forget about this.
OK, I've applied the patch, thanks.
jon