Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1523776
| From | Chris Metcalf <cmetcalf@mellanox.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2] tile: avoid using clocksource_cyc2ns with absolute cycle count |
| Date | 2016-11-16 20:40 +0100 |
| Message-ID | <sEedQ-76Q-9@gated-at.bofh.it> (permalink) |
| References | <sEedQ-76Q-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
For large values of "mult" and long uptimes, the intermediate
result of "cycles * mult" can overflow 64 bits. For example,
the tile platform calls clocksource_cyc2ns with a 1.2 GHz clock;
we have mult = 853, and after 208.5 days, we overflow 64 bits.
Since clocksource_cyc2ns() is intended to be used for relative
cycle counts, not absolute cycle counts, performance is more
importance than accepting a wider range of cycle values.
So, just use mult_frac() directly in tile's sched_clock().
Signed-off-by: Chris Metcalf <cmetcalf@mellanox.com>
---
Blackfin should make a similar change in their sched_clock().
arch/tile/kernel/time.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/tile/kernel/time.c b/arch/tile/kernel/time.c
index 178989e6d3e3..ea960d660917 100644
--- a/arch/tile/kernel/time.c
+++ b/arch/tile/kernel/time.c
@@ -218,8 +218,8 @@ void do_timer_interrupt(struct pt_regs *regs, int fault_num)
*/
unsigned long long sched_clock(void)
{
- return clocksource_cyc2ns(get_cycles(),
- sched_clock_mult, SCHED_CLOCK_SHIFT);
+ return mult_frac(get_cycles(),
+ sched_clock_mult, 1ULL << SCHED_CLOCK_SHIFT);
}
int setup_profiling_timer(unsigned int multiplier)
--
2.7.2
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH v2] tile: avoid using clocksource_cyc2ns with absolute cycle count Chris Metcalf <cmetcalf@mellanox.com> - 2016-11-16 20:40 +0100
Re: [PATCH v2] tile: avoid using clocksource_cyc2ns with absolute cycle count John Stultz <john.stultz@linaro.org> - 2016-11-16 21:00 +0100
Re: [PATCH v2] tile: avoid using clocksource_cyc2ns with absolute cycle count John Stultz <john.stultz@linaro.org> - 2016-11-16 21:30 +0100
Re: [PATCH v2] tile: avoid using clocksource_cyc2ns with absolute cycle count John Stultz <john.stultz@linaro.org> - 2016-11-16 21:40 +0100
Re: [PATCH v2] tile: avoid using clocksource_cyc2ns with absolute cycle count Peter Zijlstra <peterz@infradead.org> - 2016-11-17 11:00 +0100
Re: [PATCH v2] tile: avoid using clocksource_cyc2ns with absolute cycle count Peter Zijlstra <peterz@infradead.org> - 2016-11-18 11:40 +0100
Re: [PATCH v2] tile: avoid using clocksource_cyc2ns with absolute cycle count Peter Zijlstra <peterz@infradead.org> - 2016-11-18 16:00 +0100
csiph-web