diff options
author | Stanislaw Gruszka <sgruszka@redhat.com> | 2009-07-29 06:15:29 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-08-03 08:48:36 -0400 |
commit | a42548a18866e87092db93b771e6c5b060d78401 (patch) | |
tree | 897acf5794920ec9c6fd7f87af63908d0c1988f9 /arch/powerpc/kernel | |
parent | d1e3b6d195770bd422e3229b88edfc154b6a27dd (diff) |
cputime: Optimize jiffies_to_cputime(1)
For powerpc with CONFIG_VIRT_CPU_ACCOUNTING
jiffies_to_cputime(1) is not compile time constant and run time
calculations are quite expensive. To optimize we use
precomputed value. For all other architectures is is
preprocessor definition.
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
LKML-Reference: <1248862529-6063-5-git-send-email-sgruszka@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r-- | arch/powerpc/kernel/time.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index eae4511ceeac..211d7b0cd370 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c | |||
@@ -193,6 +193,8 @@ EXPORT_SYMBOL(__cputime_clockt_factor); | |||
193 | DEFINE_PER_CPU(unsigned long, cputime_last_delta); | 193 | DEFINE_PER_CPU(unsigned long, cputime_last_delta); |
194 | DEFINE_PER_CPU(unsigned long, cputime_scaled_last_delta); | 194 | DEFINE_PER_CPU(unsigned long, cputime_scaled_last_delta); |
195 | 195 | ||
196 | cputime_t cputime_one_jiffy; | ||
197 | |||
196 | static void calc_cputime_factors(void) | 198 | static void calc_cputime_factors(void) |
197 | { | 199 | { |
198 | struct div_result res; | 200 | struct div_result res; |
@@ -500,6 +502,7 @@ static int __init iSeries_tb_recal(void) | |||
500 | tb_to_xs = divres.result_low; | 502 | tb_to_xs = divres.result_low; |
501 | vdso_data->tb_ticks_per_sec = tb_ticks_per_sec; | 503 | vdso_data->tb_ticks_per_sec = tb_ticks_per_sec; |
502 | vdso_data->tb_to_xs = tb_to_xs; | 504 | vdso_data->tb_to_xs = tb_to_xs; |
505 | setup_cputime_one_jiffy(); | ||
503 | } | 506 | } |
504 | else { | 507 | else { |
505 | printk( "Titan recalibrate: FAILED (difference > 4 percent)\n" | 508 | printk( "Titan recalibrate: FAILED (difference > 4 percent)\n" |
@@ -945,6 +948,7 @@ void __init time_init(void) | |||
945 | tb_ticks_per_usec = ppc_tb_freq / 1000000; | 948 | tb_ticks_per_usec = ppc_tb_freq / 1000000; |
946 | tb_to_us = mulhwu_scale_factor(ppc_tb_freq, 1000000); | 949 | tb_to_us = mulhwu_scale_factor(ppc_tb_freq, 1000000); |
947 | calc_cputime_factors(); | 950 | calc_cputime_factors(); |
951 | setup_cputime_one_jiffy(); | ||
948 | 952 | ||
949 | /* | 953 | /* |
950 | * Calculate the length of each tick in ns. It will not be | 954 | * Calculate the length of each tick in ns. It will not be |