]> git.baikalelectronics.ru Git - kernel.git/commit
sched, x86: Avoid unnecessary overflow in sched_clock
authorSalman Qazi <sqazi@google.com>
Tue, 15 Nov 2011 22:12:06 +0000 (14:12 -0800)
committerIngo Molnar <mingo@elte.hu>
Wed, 16 Nov 2011 18:51:25 +0000 (19:51 +0100)
commit346196bb64ce10189691e5ad2eb16c2a0db9af00
tree58978cec1b0757fde61e53c974dff062010713df
parentfc2eb4ab65d9b76f39be6d79ed23c82c4c7c810b
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 <sqazi@google.com>
Acked-by: John Stultz <johnstul@us.ibm.com>
Reviewed-by: Paul Turner <pjt@google.com>
Cc: stable@kernel.org
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20111115221121.7262.88871.stgit@dungbeetle.mtv.corp.google.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/include/asm/timer.h