Re: Q: sched_clock() vs. clocksource, how to implement correctly

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Johannes Stezenbach
Date: Monday, April 26, 2010 - 6:18 am

On Sat, Apr 24, 2010 at 10:50:11PM +0200, Johannes Stezenbach wrote:

I found the following discussion of the sched_clock()
implementation trade-offs very informative:
http://lkml.org/lkml/2010/4/15/299

It mentions clocksource_calc_mult_shift() which was added in 2.6.33,
however I had some difficulties understanding the meaning of the minsec
parameter, especially since all existing callers use a value of 4.
But when using minsec = 365*24*60*60 (1 year) it results in the shift value of 8.

So finally the pieces connect together :-)


It seems clocksource_cyc2ns() is used in kernel/time/timekeeping.c
and kernel/time/clocksource.c only on relatively
small delta values, so there's no need to worry
about overflow and a large clocksource.shift and .mult is OK.

(Apparently the minsec value of 4 mentioned above is suitable
for timekeeping?  Where does the 4 come from?)


Thanks,
Johannes
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Q: sched_clock() vs. clocksource, how to implement correctly, Johannes Stezenbach, (Fri Apr 23, 8:09 am)
Re: Q: sched_clock() vs. clocksource, how to implement cor ..., Martin Schwidefsky, (Fri Apr 23, 9:29 am)
Re: Q: sched_clock() vs. clocksource, how to implement cor ..., Johannes Stezenbach, (Sat Apr 24, 1:50 pm)
Re: Q: sched_clock() vs. clocksource, how to implement cor ..., Johannes Stezenbach, (Mon Apr 26, 6:18 am)