diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-21 14:08:08 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-21 14:08:08 -0700 |
commit | 62bea97f54d806218a992b18d1f425cfb5060175 (patch) | |
tree | 56269aab888af586f4f63ed6a05286d11e46168c /kernel | |
parent | b61f6a57f1919ef8dbd33f864df9b8b361c65b11 (diff) | |
parent | 8af3c153baf95374eff20a37f00c59a295b52756 (diff) | |
download | kernel-common-62bea97f54d806218a992b18d1f425cfb5060175.tar.gz kernel-common-62bea97f54d806218a992b18d1f425cfb5060175.tar.bz2 kernel-common-62bea97f54d806218a992b18d1f425cfb5060175.zip |
Merge branch 'timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
ntp: Clamp PLL update interval
Diffstat (limited to 'kernel')
-rw-r--r-- | 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 c63116863a80..d2321891538f 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); |