[S390] /proc/stat idle field for idle cpus

The cpu idle field in the output of /proc/stat is too small for cpus
that have been idle for more than a tick. Add the architecture hook
arch_idle_time that allows to add the not accounted idle time of a
sleeping cpu without waking the cpu.

The s390 implementation of arch_idle_time uses the already existing
s390_idle_data per_cpu variable to find the sleep time of a neighboring
idle cpu.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
Martin Schwidefsky
2009-04-23 13:58:08 +02:00
parent b1ad171efa
commit e1c805309d
3 changed files with 25 additions and 0 deletions

View File

@@ -240,6 +240,22 @@ void vtime_stop_cpu(void)
}
}
cputime64_t s390_get_idle_time(int cpu)
{
struct s390_idle_data *idle;
unsigned long long now, idle_time, idle_enter;
idle = &per_cpu(s390_idle, cpu);
spin_lock(&idle->lock);
now = get_clock();
idle_time = 0;
idle_enter = idle->idle_enter;
if (idle_enter != 0ULL && idle_enter < now)
idle_time = now - idle_enter;
spin_unlock(&idle->lock);
return idle_time;
}
/*
* Sorted add to a list. List is linear searched until first bigger
* element is found.