diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c index ed12cbb..63f2358 100644 --- a/kernel/sched/cputime.c +++ b/kernel/sched/cputime.c @@ -543,7 +543,7 @@ static void cputime_adjust(struct task_cputime *curr, struct cputime *prev, cputime_t *ut, cputime_t *st) { - cputime_t rtime, stime, total; + cputime_t rtime, stime, utime, total; stime = curr->stime; total = stime + curr->utime; @@ -560,10 +560,13 @@ static void cputime_adjust(struct task_cputime *curr, */ rtime = nsecs_to_cputime(curr->sum_exec_runtime); - if (total) + if (total) { stime = scale_stime(stime, rtime, total); - else + utime = rtime - stime; + } else { stime = rtime; + utime = 0; + } /* * If the tick based count grows faster than the scheduler one, @@ -571,7 +574,7 @@ static void cputime_adjust(struct task_cputime *curr, * Let's enforce monotonicity. */ prev->stime = max(prev->stime, stime); - prev->utime = max(prev->utime, rtime - prev->stime); + prev->utime = max(prev->utime, utime); *ut = prev->utime; *st = prev->stime;