mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
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 <[email protected]> Acked-by: Peter Zijlstra <[email protected]> Acked-by: Thomas Gleixner <[email protected]> Cc: Oleg Nesterov <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> LKML-Reference: <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
parent
d1e3b6d195
commit
a42548a188
8 changed files with 29 additions and 10 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue