lkml.org 
[lkml]   [2018]   [May]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCHv1] timekeeping: Update multiplier when NTP frequency is set directly
On Tue, May 29, 2018 at 3:53 AM, Miroslav Lichvar <mlichvar@redhat.com> wrote:
> When the NTP frequency is set directly from userspace using the
> ADJ_FREQUENCY or ADJ_TICK timex mode, immediately update the
> timekeeper's multiplier instead of waiting for the next tick.
>
> This removes a hidden non-deterministic delay in setting of the
> frequency and allows an extremely tight control of the system clock
> with update rates close to or even exceeding the kernel HZ.
>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: John Stultz <john.stultz@linaro.org>
> Cc: Richard Cochran <richardcochran@gmail.com>
> Cc: Prarit Bhargava <prarit@redhat.com>
> Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
> ---
>
> Notes:
> RFC->v1:
> - added a new parameter to force the update of the timekeeper to the current
> NTP tick length only from adjtimex()
> - added timekeeping_advance() to keep the parameter local to timekeeping.c
>
> kernel/time/timekeeping.c | 23 ++++++++++++++++++-----
> 1 file changed, 18 insertions(+), 5 deletions(-)
>
> diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
> index 49cbceef5deb..5524c07d43e3 100644
> --- a/kernel/time/timekeeping.c
> +++ b/kernel/time/timekeeping.c
> @@ -2021,11 +2021,11 @@ static u64 logarithmic_accumulation(struct timekeeper *tk, u64 offset,
> return offset;
> }
>
> -/**
> - * update_wall_time - Uses the current clocksource to increment the wall time
> - *
> +/*
> + * timekeeping_advance - Updates the timekeeper to the current time and
> + * current NTP tick length
> */
> -void update_wall_time(void)
> +static void timekeeping_advance(bool force_update)

This is kind of a nit, but mind switching out bool for an enum? Using
something like TK_ADV_NORMAL and TK_ADV_FORCE?

> +void update_wall_time(void)
> +{
> + timekeeping_advance(false);
> +}

The enum makes usage like timekeeping_advance(false) a little less
opaque to the reader ("Wait, don't advance? Let me go look at the
function").

We got bitten by this earlier when we had the old
"timekeeping_update(tk, true, false, true)" usage.

thanks
-john

\
 
 \ /
  Last update: 2018-05-29 19:44    [W:0.044 / U:1.184 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site