Commit d61a371b authored by Ulrich Weigand's avatar Ulrich Weigand Committed by Linus Torvalds

[PATCH] cputime: s/390: fix account_steal_time.

account_steal_time called for idle doesn't work correctly:
1) steal time while idle needs to be added to the system time of idle
   to get correct uptime numbers
3) if there is an i/o request outstanding the steal time should be
   added to iowait, even if the hypervisor scheduled another virtual
   cpu since we are still waiting for i/o.
2) steal time while idle without an i/o request outstanding has to
   be added to cpustat->idle and not to cpustat->system.
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Acked-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ec6d84c7
......@@ -2383,13 +2383,17 @@ void account_system_time(struct task_struct *p, int hardirq_offset,
void account_steal_time(struct task_struct *p, cputime_t steal)
{
struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
cputime64_t steal64 = cputime_to_cputime64(steal);
cputime64_t tmp = cputime_to_cputime64(steal);
runqueue_t *rq = this_rq();
if (p == rq->idle)
cpustat->system = cputime64_add(cpustat->system, steal64);
else
cpustat->steal = cputime64_add(cpustat->steal, steal64);
if (p == rq->idle) {
p->stime = cputime_add(p->stime, steal);
if (atomic_read(&rq->nr_iowait) > 0)
cpustat->iowait = cputime64_add(cpustat->iowait, tmp);
else
cpustat->idle = cputime64_add(cpustat->idle, tmp);
} else
cpustat->steal = cputime64_add(cpustat->steal, tmp);
}
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment