Like all scheduler statistics, use sched_clock() based time.
Unified · Split
| @@ -7,9 +7,9 @@ · 6 unmodified lines | |||
| 7 | #include <linux/sched.h> | 7 | #include <linux/sched.h> |
| 8 | #include <linux/sched/task.h> | 8 | #include <linux/sched/task.h> |
| 9 | #include <linux/sched/cputime.h> | 9 | #include <linux/sched/cputime.h> |
| 10 | #include <linux/sched/clock.h> | ||
| 10 | #include <linux/slab.h> | 11 | #include <linux/slab.h> |
| 11 | #include <linux/taskstats.h> | 12 | #include <linux/taskstats.h> |
| 12 | #include <linux/time.h> | ||
| 13 | #include <linux/sysctl.h> | 13 | #include <linux/sysctl.h> |
| 14 | #include <linux/delayacct.h> | 14 | #include <linux/delayacct.h> |
| 15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
| @@ -42,10 +42,9 @@ void __delayacct_tsk_init(struct task_struct *tsk) · 26 unmodified lines | |||
| 42 | * Finish delay accounting for a statistic using its timestamps (@start), | 42 | * Finish delay accounting for a statistic using its timestamps (@start), |
| 43 | * accumalator (@total) and @count | 43 | * accumalator (@total) and @count |
| 44 | */ | 44 | */ |
| 45 | static void delayacct_end(raw_spinlock_t *lock, u64 *start, u64 *total, | 45 | static void delayacct_end(raw_spinlock_t *lock, u64 *start, u64 *total, u32 *count) |
| 46 | u32 *count) | ||
| 47 | { | 46 | { |
| 48 | s64 ns = ktime_get_ns() - *start; | 47 | s64 ns = local_clock() - *start; |
| 49 | unsigned long flags; | 48 | unsigned long flags; |
| 50 | 49 | ||
| 51 | if (ns > 0) { | 50 | if (ns > 0) { |
| @@ -58,7 +57,7 @@ static void delayacct_end(raw_spinlock_t *lock, u64 *start, u64 *total, · 6 unmodified lines | |||
| 58 | 57 | ||
| 59 | void __delayacct_blkio_start(void) | 58 | void __delayacct_blkio_start(void) |
| 60 | { | 59 | { |
| 61 | current->delays->blkio_start = ktime_get_ns(); | 60 | current->delays->blkio_start = local_clock(); |
| 62 | } | 61 | } |
| 63 | 62 | ||
| 64 | /* | 63 | /* |
| @@ -151,21 +150,20 @@ __u64 __delayacct_blkio_ticks(struct task_struct *tsk) · 86 unmodified lines | |||
| 151 | 150 | ||
| 152 | void __delayacct_freepages_start(void) | 151 | void __delayacct_freepages_start(void) |
| 153 | { | 152 | { |
| 154 | current->delays->freepages_start = ktime_get_ns(); | 153 | current->delays->freepages_start = local_clock(); |
| 155 | } | 154 | } |
| 156 | 155 | ||
| 157 | void __delayacct_freepages_end(void) | 156 | void __delayacct_freepages_end(void) |
| 158 | { | 157 | { |
| 159 | delayacct_end( | 158 | delayacct_end(¤t->delays->lock, |
| 160 | ¤t->delays->lock, | 159 | ¤t->delays->freepages_start, |
| 161 | ¤t->delays->freepages_start, | 160 | ¤t->delays->freepages_delay, |
| 162 | ¤t->delays->freepages_delay, | 161 | ¤t->delays->freepages_count); |
| 163 | ¤t->delays->freepages_count); | ||
| 164 | } | 162 | } |
| 165 | 163 | ||
| 166 | void __delayacct_thrashing_start(void) | 164 | void __delayacct_thrashing_start(void) |
| 167 | { | 165 | { |
| 168 | current->delays->thrashing_start = ktime_get_ns(); | 166 | current->delays->thrashing_start = local_clock(); |
| 169 | } | 167 | } |
| 170 | 168 | ||
| 171 | void __delayacct_thrashing_end(void) | 169 | void __delayacct_thrashing_end(void) |