aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/time.c
diff options
context:
space:
mode:
authorMichael Neuling <mikey@neuling.org>2008-02-06 04:36:12 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-06 13:41:00 -0500
commit06b8e878a9bc9301201cffe186eba99c4185f20a (patch)
tree857434ed559cdb001177e81283be6f0b5693a781 /arch/powerpc/kernel/time.c
parentd9afa43532adf8a31b93c4c7601fda3f423d8972 (diff)
taskstats scaled time cleanup
This moves the ability to scale cputime into generic code. This allows us to fix the issue in kernel/timer.c (noticed by Balbir) where we could only add an unscaled value to the scaled utime/stime. This adds a cputime_to_scaled function. As before, the POWERPC version does the scaling based on the last SPURR/PURR ratio calculated. The generic and s390 (only other arch to implement asm/cputime.h) versions are both NOPs. Also moves the SPURR and PURR snapshots closer. Signed-off-by: Michael Neuling <mikey@neuling.org> Cc: Jay Lan <jlan@engr.sgi.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/powerpc/kernel/time.c')
-rw-r--r--arch/powerpc/kernel/time.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 5cd3db5cae41..3b26fbd6bec9 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -66,6 +66,7 @@
66#include <asm/smp.h> 66#include <asm/smp.h>
67#include <asm/vdso_datapage.h> 67#include <asm/vdso_datapage.h>
68#include <asm/firmware.h> 68#include <asm/firmware.h>
69#include <asm/cputime.h>
69#ifdef CONFIG_PPC_ISERIES 70#ifdef CONFIG_PPC_ISERIES
70#include <asm/iseries/it_lp_queue.h> 71#include <asm/iseries/it_lp_queue.h>
71#include <asm/iseries/hv_call_xm.h> 72#include <asm/iseries/hv_call_xm.h>
@@ -189,6 +190,8 @@ u64 __cputime_sec_factor;
189EXPORT_SYMBOL(__cputime_sec_factor); 190EXPORT_SYMBOL(__cputime_sec_factor);
190u64 __cputime_clockt_factor; 191u64 __cputime_clockt_factor;
191EXPORT_SYMBOL(__cputime_clockt_factor); 192EXPORT_SYMBOL(__cputime_clockt_factor);
193DEFINE_PER_CPU(unsigned long, cputime_last_delta);
194DEFINE_PER_CPU(unsigned long, cputime_scaled_last_delta);
192 195
193static void calc_cputime_factors(void) 196static void calc_cputime_factors(void)
194{ 197{
@@ -257,8 +260,8 @@ void account_system_vtime(struct task_struct *tsk)
257 } 260 }
258 account_system_time(tsk, 0, delta); 261 account_system_time(tsk, 0, delta);
259 account_system_time_scaled(tsk, deltascaled); 262 account_system_time_scaled(tsk, deltascaled);
260 get_paca()->purrdelta = delta; 263 per_cpu(cputime_last_delta, smp_processor_id()) = delta;
261 get_paca()->spurrdelta = deltascaled; 264 per_cpu(cputime_scaled_last_delta, smp_processor_id()) = deltascaled;
262 local_irq_restore(flags); 265 local_irq_restore(flags);
263} 266}
264 267
@@ -276,10 +279,7 @@ void account_process_tick(struct task_struct *tsk, int user_tick)
276 get_paca()->user_time = 0; 279 get_paca()->user_time = 0;
277 account_user_time(tsk, utime); 280 account_user_time(tsk, utime);
278 281
279 /* Estimate the scaled utime by scaling the real utime based 282 utimescaled = cputime_to_scaled(utime);
280 * on the last spurr to purr ratio */
281 utimescaled = utime * get_paca()->spurrdelta / get_paca()->purrdelta;
282 get_paca()->spurrdelta = get_paca()->purrdelta = 0;
283 account_user_time_scaled(tsk, utimescaled); 283 account_user_time_scaled(tsk, utimescaled);
284} 284}
285 285