diff options
author | Michael Neuling <mikey@neuling.org> | 2008-02-06 04:36:12 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-06 13:41:00 -0500 |
commit | 06b8e878a9bc9301201cffe186eba99c4185f20a (patch) | |
tree | 857434ed559cdb001177e81283be6f0b5693a781 /kernel/timer.c | |
parent | d9afa43532adf8a31b93c4c7601fda3f423d8972 (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 'kernel/timer.c')
-rw-r--r-- | kernel/timer.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/kernel/timer.c b/kernel/timer.c index 9fbb472b8cf0..70b29b59343f 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -818,12 +818,14 @@ unsigned long next_timer_interrupt(void) | |||
818 | #ifndef CONFIG_VIRT_CPU_ACCOUNTING | 818 | #ifndef CONFIG_VIRT_CPU_ACCOUNTING |
819 | void account_process_tick(struct task_struct *p, int user_tick) | 819 | void account_process_tick(struct task_struct *p, int user_tick) |
820 | { | 820 | { |
821 | cputime_t one_jiffy = jiffies_to_cputime(1); | ||
822 | |||
821 | if (user_tick) { | 823 | if (user_tick) { |
822 | account_user_time(p, jiffies_to_cputime(1)); | 824 | account_user_time(p, one_jiffy); |
823 | account_user_time_scaled(p, jiffies_to_cputime(1)); | 825 | account_user_time_scaled(p, cputime_to_scaled(one_jiffy)); |
824 | } else { | 826 | } else { |
825 | account_system_time(p, HARDIRQ_OFFSET, jiffies_to_cputime(1)); | 827 | account_system_time(p, HARDIRQ_OFFSET, one_jiffy); |
826 | account_system_time_scaled(p, jiffies_to_cputime(1)); | 828 | account_system_time_scaled(p, cputime_to_scaled(one_jiffy)); |
827 | } | 829 | } |
828 | } | 830 | } |
829 | #endif | 831 | #endif |