[ntp:questions] Re: ntpd PLL and clock overshoot

David Woolley david at djwhome.demon.co.uk
Sun Oct 15 19:58:54 UTC 2006

In article <45325369.2060102 at gmail.com>,
Bart Van Assche <bart.vanassche at gmail.com> wrote:

> Other people asked where the Linux implementation of the adjtimex() 
> system call can be found. Its implementation resides in source file 
> kernel/time.c, functions sys_adjtimex() and do_adjtimex(). See e.g. 
> http://www.kernelhq.cc/browse.py?css=taichi

No.  They asked where tickadj was implemented, and the important part of
that was originally in sched.c and for 2.4.26 was in timer.c.  For 2.4,
at least, it looks like adjtime is implemented using the one shot mode
of adjtimex.  The relevant code in timer.c is update_wall_time_one_tick().

This version does not have a non-linear behaviour, but, what might confuse
ntpd, is that the slew rate is only exactly 500 ppm if the HZ value 
exactly divides 500.  In particular, for HZ=1000, it is clamped to one
microsecond per tick, i.e. 1000ppm.  (I don't think the HZ=1000 case is a
problem, for ntpd, but non-divisors of 500, below 500, may mean that the
maximum slew rate is less than ntpd assumes, e.g. 500/200 is 2, giving
a maximum slew rate of 400ppm if HZ is 200.)  Note that this all only
applies if you disable kernel or you use tinker options that don't allow
it to be used.

It's possible that 2.6 versions do do something more clever.  It's also
possible that the routine is in yet another source file.

More information about the questions mailing list