diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2009-04-23 07:58:08 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2009-04-23 07:58:17 -0400 |
commit | e1c805309d19c69d4ebeac38724076fa86feacdf (patch) | |
tree | 73886783aac7c489a29f3e5eec56cbc2371a12dd /arch/s390 | |
parent | b1ad171efa089ae26aba750d747d8149a4f860d5 (diff) |
[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>
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/include/asm/cputime.h | 4 | ||||
-rw-r--r-- | arch/s390/kernel/vtime.c | 16 |
2 files changed, 20 insertions, 0 deletions
diff --git a/arch/s390/include/asm/cputime.h b/arch/s390/include/asm/cputime.h index 95b0f7db3c69..941384fbd39c 100644 --- a/arch/s390/include/asm/cputime.h +++ b/arch/s390/include/asm/cputime.h | |||
@@ -174,4 +174,8 @@ cputime64_to_clock_t(cputime64_t cputime) | |||
174 | return __div(cputime, 4096000000ULL / USER_HZ); | 174 | return __div(cputime, 4096000000ULL / USER_HZ); |
175 | } | 175 | } |
176 | 176 | ||
177 | cputime64_t s390_get_idle_time(int cpu); | ||
178 | |||
179 | #define arch_idle_time(cpu) s390_get_idle_time(cpu) | ||
180 | |||
177 | #endif /* _S390_CPUTIME_H */ | 181 | #endif /* _S390_CPUTIME_H */ |
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c index 38ea92ff04f9..c87f59bd8246 100644 --- a/arch/s390/kernel/vtime.c +++ b/arch/s390/kernel/vtime.c | |||
@@ -240,6 +240,22 @@ void vtime_stop_cpu(void) | |||
240 | } | 240 | } |
241 | } | 241 | } |
242 | 242 | ||
243 | cputime64_t s390_get_idle_time(int cpu) | ||
244 | { | ||
245 | struct s390_idle_data *idle; | ||
246 | unsigned long long now, idle_time, idle_enter; | ||
247 | |||
248 | idle = &per_cpu(s390_idle, cpu); | ||
249 | spin_lock(&idle->lock); | ||
250 | now = get_clock(); | ||
251 | idle_time = 0; | ||
252 | idle_enter = idle->idle_enter; | ||
253 | if (idle_enter != 0ULL && idle_enter < now) | ||
254 | idle_time = now - idle_enter; | ||
255 | spin_unlock(&idle->lock); | ||
256 | return idle_time; | ||
257 | } | ||
258 | |||
243 | /* | 259 | /* |
244 | * Sorted add to a list. List is linear searched until first bigger | 260 | * Sorted add to a list. List is linear searched until first bigger |
245 | * element is found. | 261 | * element is found. |