]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - kernel/sched/cputime.c
sched/cputime: Fix steal time accounting
[mirror_ubuntu-bionic-kernel.git] / kernel / sched / cputime.c
index ea0f6f31a2449440e502ee029eb2f3cfe2328c1b..8b9bcc5a58faddc51687ec1ee84c17ec6217e2ce 100644 (file)
@@ -502,29 +502,26 @@ void account_process_tick(struct task_struct *p, int user_tick)
                account_idle_time(cputime);
 }
 
-/*
- * Account multiple ticks of steal time.
- * @p: the process from which the cpu time has been stolen
- * @ticks: number of stolen ticks
- */
-void account_steal_ticks(unsigned long ticks)
-{
-       account_steal_time(jiffies_to_cputime(ticks));
-}
-
 /*
  * Account multiple ticks of idle time.
  * @ticks: number of stolen ticks
  */
 void account_idle_ticks(unsigned long ticks)
 {
-
+       cputime_t cputime, steal;
        if (sched_clock_irqtime) {
                irqtime_account_idle_ticks(ticks);
                return;
        }
 
-       account_idle_time(jiffies_to_cputime(ticks));
+       cputime = cputime_one_jiffy;
+       steal = steal_account_process_time(cputime);
+
+       if (steal >= cputime)
+               return;
+
+       cputime -= steal;
+       account_idle_time(cputime);
 }
 
 /*