[git commit] ntpd: do not invalidate datapoints after step
Denys Vlasenko
vda.linux at googlemail.com
Sat Dec 7 16:29:03 UTC 2013
commit: http://git.busybox.net/busybox/commit/?id=777be10ebebb4afdaf057a5abe094c86eb6d8a2c
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master
Used to set p->filter_datapoint[i].d_dispersion = MAXDISP
and clear reachable bits, but this proved to be too agressive:
after step (tested with suspinding laptop for ~30 secs),
this caused all previous data to be considered invalid,
making us needing to collect full ~8 datapoins per peer
after step in order to start trusting them.
In turn, this was making poll interval decrease even after
step was done. (Poll interval decreases already before step
in this scenario, because we see large offsets and end up with
no good peer to select).
function old new delta
reset_peer_stats 157 139 -18
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
networking/ntpd.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/networking/ntpd.c b/networking/ntpd.c
index f3a4177..fd2f24a 100644
--- a/networking/ntpd.c
+++ b/networking/ntpd.c
@@ -678,6 +678,18 @@ reset_peer_stats(peer_t *p, double offset)
int i;
bool small_ofs = fabs(offset) < 16 * STEP_THRESHOLD;
+ /* Used to set p->filter_datapoint[i].d_dispersion = MAXDISP
+ * and clear reachable bits, but this proved to be too agressive:
+ * after step (tested with suspinding laptop for ~30 secs),
+ * this caused all previous data to be considered invalid,
+ * making us needing to collect full ~8 datapoins per peer
+ * after step in order to start trusting them.
+ * In turn, this was making poll interval decrease even after
+ * step was done. (Poll interval decreases already before step
+ * in this scenario, because we see large offsets and end up with
+ * no good peer to select).
+ */
+
for (i = 0; i < NUM_DATAPOINTS; i++) {
if (small_ofs) {
p->filter_datapoint[i].d_recv_time += offset;
@@ -691,13 +703,13 @@ reset_peer_stats(peer_t *p, double offset)
} else {
p->filter_datapoint[i].d_recv_time = G.cur_time;
p->filter_datapoint[i].d_offset = 0;
- p->filter_datapoint[i].d_dispersion = MAXDISP;
+ /*p->filter_datapoint[i].d_dispersion = MAXDISP;*/
}
}
if (small_ofs) {
p->lastpkt_recv_time += offset;
} else {
- p->reachable_bits = 0;
+ /*p->reachable_bits = 0;*/
p->lastpkt_recv_time = G.cur_time;
}
filter_datapoints(p); /* recalc p->filter_xxx */
More information about the busybox-cvs
mailing list