Skip to content
Commit 4cecf6d4 authored by Salman Qazi's avatar Salman Qazi Committed by Ingo Molnar
Browse files

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: default avatarSalman Qazi <sqazi@google.com>
Acked-by: default avatarJohn Stultz <johnstul@us.ibm.com>
Reviewed-by: default avatarPaul Turner <pjt@google.com>
Cc: stable@kernel.org
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20111115221121.7262.88871.stgit@dungbeetle.mtv.corp.google.com


Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent fccfdc6f
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment