Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752541AbeAERO5 (ORCPT + 1 other); Fri, 5 Jan 2018 12:14:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44002 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752520AbeAEROx (ORCPT ); Fri, 5 Jan 2018 12:14:53 -0500 From: Miroslav Lichvar To: linux-kernel@vger.kernel.org Cc: Miroslav Lichvar , John Stultz , Prarit Bhargava , Richard Cochran Subject: [PATCHv2 1/2] timekeeping: Don't align frequency adjustments to ticks Date: Fri, 5 Jan 2018 18:14:47 +0100 Message-Id: <20180105171448.14533-2-mlichvar@redhat.com> In-Reply-To: <20180105171448.14533-1-mlichvar@redhat.com> References: <20180105171448.14533-1-mlichvar@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 05 Jan 2018 17:14:53 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: When the timekeeping multiplier is changed, the NTP error is updated to correct the clock for the delay between the tick and the update of the clock. This error is corrected in later updates and the clock appears as if the frequency was changed exactly on the tick. Remove this correction to keep the point where the frequency is effectively changed at the time of the update. This removes a major source of the NTP error. Cc: John Stultz Cc: Prarit Bhargava Cc: Richard Cochran Signed-off-by: Miroslav Lichvar --- kernel/time/timekeeping.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index cd03317..c1a0ac1 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1860,8 +1860,6 @@ static __always_inline void timekeeping_apply_adjustment(struct timekeeper *tk, * xtime_nsec_2 = xtime_nsec_1 - offset * Which simplfies to: * xtime_nsec -= offset - * - * XXX - TODO: Doc ntp_error calculation. */ if ((mult_adj > 0) && (tk->tkr_mono.mult + mult_adj < mult_adj)) { /* NTP adjustment caused clocksource mult overflow */ @@ -1872,7 +1870,6 @@ static __always_inline void timekeeping_apply_adjustment(struct timekeeper *tk, tk->tkr_mono.mult += mult_adj; tk->xtime_interval += interval; tk->tkr_mono.xtime_nsec -= offset; - tk->ntp_error -= (interval - offset) << tk->ntp_error_shift; } /* -- 2.9.5