summaryrefslogtreecommitdiffstats
path: root/kernel/itimer.c
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2009-07-29 12:15:29 +0200
committerIngo Molnar <mingo@elte.hu>2009-08-03 14:48:36 +0200
commita42548a18866e87092db93b771e6c5b060d78401 (patch)
tree897acf5794920ec9c6fd7f87af63908d0c1988f9 /kernel/itimer.c
parentd1e3b6d195770bd422e3229b88edfc154b6a27dd (diff)
downloadlinux-a42548a18866e87092db93b771e6c5b060d78401.tar.gz
linux-a42548a18866e87092db93b771e6c5b060d78401.tar.bz2
linux-a42548a18866e87092db93b771e6c5b060d78401.zip
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 'kernel/itimer.c')
-rw-r--r--kernel/itimer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/itimer.c b/kernel/itimer.c
index 21adff7b2a17..8078a32d3b10 100644
--- a/kernel/itimer.c
+++ b/kernel/itimer.c
@@ -64,7 +64,7 @@ static void get_cpu_itimer(struct task_struct *tsk, unsigned int clock_id,
if (cputime_le(cval, t))
/* about to fire */
- cval = jiffies_to_cputime(1);
+ cval = cputime_one_jiffy;
else
cval = cputime_sub(cval, t);
}
@@ -161,7 +161,7 @@ static void set_cpu_itimer(struct task_struct *tsk, unsigned int clock_id,
if (!cputime_eq(cval, cputime_zero) ||
!cputime_eq(nval, cputime_zero)) {
if (cputime_gt(nval, cputime_zero))
- nval = cputime_add(nval, jiffies_to_cputime(1));
+ nval = cputime_add(nval, cputime_one_jiffy);
set_process_cpu_timer(tsk, clock_id, &nval, &cval);
}
it->expires = nval;