diff options
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/sched/cputime.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c index 99947919e30b..c91b09770ebd 100644 --- a/kernel/sched/cputime.c +++ b/kernel/sched/cputime.c | |||
| @@ -258,16 +258,22 @@ static __always_inline bool steal_account_process_tick(void) | |||
| 258 | { | 258 | { |
| 259 | #ifdef CONFIG_PARAVIRT | 259 | #ifdef CONFIG_PARAVIRT |
| 260 | if (static_key_false(¶virt_steal_enabled)) { | 260 | if (static_key_false(¶virt_steal_enabled)) { |
| 261 | u64 steal, st = 0; | 261 | u64 steal; |
| 262 | cputime_t steal_ct; | ||
| 262 | 263 | ||
| 263 | steal = paravirt_steal_clock(smp_processor_id()); | 264 | steal = paravirt_steal_clock(smp_processor_id()); |
| 264 | steal -= this_rq()->prev_steal_time; | 265 | steal -= this_rq()->prev_steal_time; |
| 265 | 266 | ||
| 266 | st = steal_ticks(steal); | 267 | /* |
| 267 | this_rq()->prev_steal_time += st * TICK_NSEC; | 268 | * cputime_t may be less precise than nsecs (eg: if it's |
| 269 | * based on jiffies). Lets cast the result to cputime | ||
| 270 | * granularity and account the rest on the next rounds. | ||
| 271 | */ | ||
| 272 | steal_ct = nsecs_to_cputime(steal); | ||
| 273 | this_rq()->prev_steal_time += cputime_to_nsecs(steal_ct); | ||
| 268 | 274 | ||
| 269 | account_steal_time(st); | 275 | account_steal_time(steal_ct); |
| 270 | return st; | 276 | return steal_ct; |
| 271 | } | 277 | } |
| 272 | #endif | 278 | #endif |
| 273 | return false; | 279 | return false; |
