From: john stultz <johnstul@us.ibm.com>
To: Miroslav Lichvar <mlichvar@redhat.com>
Cc: linux-kernel@vger.kernel.org, Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] ntp: Clamp PLL update interval
Date: Thu, 09 Sep 2010 11:16:54 -0700 [thread overview]
Message-ID: <1284056214.2762.55.camel@localhost.localdomain> (raw)
In-Reply-To: <1283870626-9472-1-git-send-email-mlichvar@redhat.com>
On Tue, 2010-09-07 at 16:43 +0200, Miroslav Lichvar wrote:
> Clamp update interval to reduce PLL gain with low sampling rate (e.g.
> intermittent network connection) to avoid instability.
>
> The clamp roughly corresponds to the loop time constant, it's 8 * poll
> interval for SHIFT_PLL 2 and 32 * poll interval for SHIFT_PLL 4. This
> gives good results without affecting the gain in normal conditions where
> ntpd skips only up to seven consecutive samples.
>
> Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Thanks Miroslav!
Acked-by: John Stultz <johnstul@us.ibm.com>
> ---
> kernel/time/ntp.c | 14 +++++++++++---
> 1 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
> index c631168..d232189 100644
> --- a/kernel/time/ntp.c
> +++ b/kernel/time/ntp.c
> @@ -149,10 +149,18 @@ static void ntp_update_offset(long offset)
> time_reftime = get_seconds();
>
> offset64 = offset;
> - freq_adj = (offset64 * secs) <<
> - (NTP_SCALE_SHIFT - 2 * (SHIFT_PLL + 2 + time_constant));
> + freq_adj = ntp_update_offset_fll(offset64, secs);
>
> - freq_adj += ntp_update_offset_fll(offset64, secs);
> + /*
> + * Clamp update interval to reduce PLL gain with low
> + * sampling rate (e.g. intermittent network connection)
> + * to avoid instability.
> + */
> + if (unlikely(secs > 1 << (SHIFT_PLL + 1 + time_constant)))
> + secs = 1 << (SHIFT_PLL + 1 + time_constant);
> +
> + freq_adj += (offset64 * secs) <<
> + (NTP_SCALE_SHIFT - 2 * (SHIFT_PLL + 2 + time_constant));
>
> freq_adj = min(freq_adj + time_freq, MAXFREQ_SCALED);
>
next prev parent reply other threads:[~2010-09-09 18:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-07 14:43 Miroslav Lichvar
2010-09-09 18:16 ` john stultz [this message]
2010-09-09 18:51 ` [tip:timers/core] " tip-bot for Miroslav Lichvar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1284056214.2762.55.camel@localhost.localdomain \
--to=johnstul@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mlichvar@redhat.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome