diff options
author | Ross Biro <ross.biro@gmail.com> | 2006-01-11 16:43:51 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-11 22:04:52 -0500 |
commit | 79c62cf1789f935280138b412bb750be84aec747 (patch) | |
tree | 24c522ed0dd3dba942f1db43048205b0973aa7c8 /arch/x86_64/lib/delay.c | |
parent | e4e94072d9c3b19662537cbd5e2d37bcaeed3d9b (diff) |
[PATCH] x86_64: Make udelay more accurate
The attempt to avoid overflow in __delay caused varying precision
on different CPUs depending on differences in the CPU speed.
We should be able to do this multiplication with out overflowing
provided the
cpu is running at less than about 128 GHz. xloops < 20000 * 0x10c6.
loops_per_jiffy * HZ <= cpu_clock_speed. So if the cpu clock speed
< 2^64/(20000 * 0x10c6) = 2^64/ 51E6CC0 < 2^64/2^27 = 2^37 = 128G we
will not overflow the calculation.
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/x86_64/lib/delay.c')
-rw-r--r-- | arch/x86_64/lib/delay.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86_64/lib/delay.c b/arch/x86_64/lib/delay.c index 841bd738a189..03c460cbdd1c 100644 --- a/arch/x86_64/lib/delay.c +++ b/arch/x86_64/lib/delay.c | |||
@@ -39,7 +39,7 @@ void __delay(unsigned long loops) | |||
39 | 39 | ||
40 | inline void __const_udelay(unsigned long xloops) | 40 | inline void __const_udelay(unsigned long xloops) |
41 | { | 41 | { |
42 | __delay(((xloops * cpu_data[raw_smp_processor_id()].loops_per_jiffy) >> 32) * HZ); | 42 | __delay((xloops * HZ * cpu_data[raw_smp_processor_id()].loops_per_jiffy) >> 32); |
43 | } | 43 | } |
44 | 44 | ||
45 | void __udelay(unsigned long usecs) | 45 | void __udelay(unsigned long usecs) |