]> Git Repo - linux.git/commit
sched, x86: Avoid unnecessary overflow in sched_clock
authorSalman Qazi <[email protected]>
Tue, 15 Nov 2011 22:12:06 +0000 (14:12 -0800)
committerIngo Molnar <[email protected]>
Wed, 16 Nov 2011 18:51:25 +0000 (19:51 +0100)
commit4cecf6d401a01d054afc1e5f605bcbfe553cb9b9
tree58978cec1b0757fde61e53c974dff062010713df
parentfccfdc6f0d8c83c854eeb6d93aa158f0e551bd49
sched, x86: Avoid unnecessary overflow in sched_clock

(Added the missing signed-off-by line)

In hundreds of days, the __cycles_2_ns calculation in sched_clock
has an overflow.  cyc * per_cpu(cyc2ns, cpu) exceeds 64 bits, causing
the final value to become zero.  We can solve this without losing
any precision.

We can decompose TSC into quotient and remainder of division by the
scale factor, and then use this to convert TSC into nanoseconds.

Signed-off-by: Salman Qazi <[email protected]>
Acked-by: John Stultz <[email protected]>
Reviewed-by: Paul Turner <[email protected]>
Cc: [email protected]
Signed-off-by: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
arch/x86/include/asm/timer.h
This page took 0.042862 seconds and 4 git commands to generate.