@@ -258,12 +258,17 @@ static __always_inline bool steal_account_process_tick(void)
{
#ifdef CONFIG_PARAVIRT
if (static_key_false(¶virt_steal_enabled)) {
- u64 steal;
+ u64 steal, prev;
cputime_t steal_ct;
steal = paravirt_steal_clock(smp_processor_id());
- steal -= this_rq()->prev_steal_time;
-
+ prev = this_rq()->prev_steal_time;
+ if (steal >= prev)
+ steal -= prev;
+ else {
+ printk("WARNING: %lld - %lld is negative!!\n", steal, prev);
+ this_rq()->prev_steal_time = steal;
+ }
/*
* cputime_t may be less precise than nsecs (eg: if it's
* based on jiffies). Lets cast the result to cputime