Date: Wed, 11 Oct 2017 12:31:01 +0300 From: Konstantin Belousov <kostikbel@gmail.com> To: Sebastian Huber <sebastian.huber@embedded-brains.de> Cc: freebsd-hackers@freebsd.org Subject: Re: [PATCH] Simplify th_bintime update in tc_windup() Message-ID: <20171011093101.GX95911@kib.kiev.ua> In-Reply-To: <20171011064816.20809-1-sebastian.huber@embedded-brains.de> References: <20171011064816.20809-1-sebastian.huber@embedded-brains.de>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Oct 11, 2017 at 08:48:16AM +0200, Sebastian Huber wrote: > The th_bintime, th_microtime and th_nanotime members of the timehand all > cache the last system time (uptime + boottime). Only the format > differs. Do not re-calculate the bintime and simply use the value used > to calculate the microtime and nanotime. > > Group all the updates under the relevant comment. th->th_bintime is recalculated after possible adjustments made by the ntp loop to the th_boottime. But your patch makes me consider the two lines after the XXX comment. Shouldn't we use the updated th_bintime instead of the pre-adjustment bt value ? > > Is the > > "XXX shouldn't do this here. Should force non-`get' versions." > > part of the comment still valid? > --- > sys/kern/kern_tc.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c > index 088fcb41cfa..e7cfc51aff7 100644 > --- a/sys/kern/kern_tc.c > +++ b/sys/kern/kern_tc.c > @@ -1413,10 +1413,9 @@ tc_windup(struct bintime *new_boottimebin) > if (bt.sec != t) > th->th_boottime.sec += bt.sec - t; > } > - th->th_bintime = th->th_offset; > - bintime_add(&th->th_bintime, &th->th_boottime); > /* Update the UTC timestamps used by the get*() functions. */ > /* XXX shouldn't do this here. Should force non-`get' versions. */ > + th->th_bintime = bt; > bintime2timeval(&bt, &th->th_microtime); > bintime2timespec(&bt, &th->th_nanotime); > > -- > 2.12.3
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20171011093101.GX95911>