]> Git Repo - linux.git/commit - kernel/time/hrtimer.c
ktime: Optimize ktime_divns for constant divisors
authorNicolas Pitre <[email protected]>
Wed, 3 Dec 2014 19:43:06 +0000 (14:43 -0500)
committerJohn Stultz <[email protected]>
Sat, 24 Jan 2015 01:21:31 +0000 (17:21 -0800)
commit8b618628b2bf83512fc8df5e8672619d65adfdfb
treec295bed4f4e702f5f39fcce622258e55242b1d93
parenteaa27f34e91a14cdceed26ed6c6793ec1d186115
ktime: Optimize ktime_divns for constant divisors

At least on ARM, do_div() is optimized to turn constant divisors into
an inline multiplication by the reciprocal value at compile time.
However this optimization is missed entirely whenever ktime_divns() is
used and the slow out-of-line division code is used all the time.

Let ktime_divns() use do_div() inline whenever the divisor is constant
and small enough.  This will make things like ktime_to_us() and
ktime_to_ms() much faster.

Cc: Arnd Bergmann <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Nicolas Pitre <[email protected]>
Acked-by: Arnd Bergmann <[email protected]>
Signed-off-by: Nicolas Pitre <[email protected]>
Signed-off-by: John Stultz <[email protected]>
include/linux/ktime.h
kernel/time/hrtimer.c
This page took 0.060273 seconds and 4 git commands to generate.