[ntp:questions] Clarification on 'discard' command, and possibly 'mru'...

Jason Rabel jasonrabel99 at gmail.com
Fri Jan 4 19:47:51 UTC 2019


Argh, didn't realize I only replied directly to you in my previous
email. This one should go to the list too.

Anyhow, I dug through the source and found what I think is the
relevant information.

It's in ntp_monitor.c near the bottom.

(note, near the top there is: int mon_age = 3000;)

/*
* If we got here, this is the first we've heard of this
* guy.  Get him some memory, either from the free list
* or from the tail of the MRU list.
....

/* Preempt from the MRU list if old enough. */
} else if (ntp_random() / (2. * FRAC) >
   (double)oldest_age / mon_age) {
return ~(RES_LIMITED | RES_KOD) & flags;
} else {
mon_reclaim_entry(oldest);
mon = oldest;

FRAC seems to be defined elsewhere as 2^32. Not sure where ntp_random
comes from or its range. I'm still kind of scratching my head over
what is being compared and why.


I found the references to the discard 'average' and 'minimum'
settings, they are in ntp_config.c & ntp_monitor.c

In the monitor file the comments seems to indicate both are in (log 2 s) format?


More information about the questions mailing list