From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932142AbdEQQNp (ORCPT ); Wed, 17 May 2017 12:13:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11088 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753509AbdEQQNX (ORCPT ); Wed, 17 May 2017 12:13:23 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C6F0280F8E Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=mlichvar@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com C6F0280F8E From: Miroslav Lichvar To: linux-kernel@vger.kernel.org Cc: John Stultz , Prarit Bhargava , Richard Cochran Subject: [PATCH RFC 2/3] timekeeping: Don't align frequency adjustments to ticks Date: Wed, 17 May 2017 18:13:16 +0200 Message-Id: <20170517161317.19557-3-mlichvar@redhat.com> In-Reply-To: <20170517161317.19557-1-mlichvar@redhat.com> References: <20170517161317.19557-1-mlichvar@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 17 May 2017 16:13:22 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When the timekeeping multiplier is adjusted, the NTP error is adjusted to correct the clock for the misalignment of the update to the start of the tick. 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 ff542dd..5ae6f27 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1760,8 +1760,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 */ @@ -1772,7 +1770,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.3