Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1153702imm; Wed, 23 May 2018 11:06:47 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrEffjz7y7eac7RQWOfMPMMXS3S7JpGZvfojR7bgCh5WPMYwnuQKTP3h85SEqM/3Ejqn/bM X-Received: by 2002:a17:902:52ed:: with SMTP id a100-v6mr3951145pli.131.1527098807521; Wed, 23 May 2018 11:06:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527098807; cv=none; d=google.com; s=arc-20160816; b=Cnv2VGJ2RXLZxrF8rRIYHki1lgrh4+5Rz3KbqZIAzicmLmA2wh1ujkqzO+f0j18MBK QjCQJ3C4aA0JoVBxasvmi2HfszXaCMAmeNLkNl2UtbFSTXBGEeAvvnR00dphWHmu873a gY/V5xGGnjA+3jwnJBlJi+qy8p6WQyVc0bMEQ3YKVAM9umhgmt+W9U+MWTg1ripr3uPq VxEgKOIcIF1W6bsqsuewdWoMza9RX4ruX51abzmKSM0Rf0oqEzww/lqXxfxqgN9TXCRh yT9dWdmK/rIz9Lw3e+0HVBYQSabEY+EbS6UNToqHxCMkoeFx6Xqj61n7SsmDzFFPWksQ 3/bA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=UzhThERYL6k17oVI67Dnkny5kjzO/eJdLYTKsqjufrw=; b=Gw7VLuyS+kv/4YfnSKLdUOA8shI+/MshNQOiHTW/1sCPPUrFFNHDix5qZxCPYaWXjK Mf/CbkcKlRFJQXq7sUV8+246frwRfL92tr+kyB0d/snaNzvPdcj67x7tlsS4dDAfmjl7 ERsuUaMbtHnTvn4NbIWl9jGoME0ZrmtBUHMSGB0ekXYpqQIC3PRaJFip5ltPv6md1/E5 CRB+mAL9meWzI436WjyXPzxE24ejx12SuG2JUwNwP+F3s8prCY+7HRLEbZmwvO4baF/8 vyux11HWjAozav+X0v8POhHKIG6u8VVRRJeB1A09F11FBR6jl+/jFjv0skV9cIECfUWS UeLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NMgDA/+6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g9-v6si14961009pgq.145.2018.05.23.11.05.59; Wed, 23 May 2018 11:06:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NMgDA/+6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933865AbeEWSFn (ORCPT + 99 others); Wed, 23 May 2018 14:05:43 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:37619 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933706AbeEWSFg (ORCPT ); Wed, 23 May 2018 14:05:36 -0400 Received: by mail-wr0-f196.google.com with SMTP id i12-v6so14948486wrc.4 for ; Wed, 23 May 2018 11:05:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=UzhThERYL6k17oVI67Dnkny5kjzO/eJdLYTKsqjufrw=; b=NMgDA/+67OZPKha4ijFn1cNcg/Fcbi/XcK2JESvb2SauEf7tG31kawIirHsg8BtZbR pCBenL61FFFYQYAE3lZimqr3sbfdFCZjbgTamSWO1Zs4D58bLe8MDsoYCIhxCypJeCbP fiydYKdB5ItGq1BEI64Nl1p3RxA7mq+I017KA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=UzhThERYL6k17oVI67Dnkny5kjzO/eJdLYTKsqjufrw=; b=Qp1PYjgHC1X1MjNvS1tEnYSKm7FdI5+eUZV9q4Nj9J9teXlrx/I3jzyuNsEZnsR+/b C1C0X0+n56n0av4GC8BJELB3ZjQxkF3A8+qzpK9mUhwPnBxeyaFiklPdFTs9rrD1zWPM w4vQ3Jy/BgFKhi3CBbd6TPhuXegKq70loHO+B1JwQIzeyQuA6q6C8tvSAwnBua8lqz45 HTKUeLOLBpyMfJO/bqop90qj1Wb5Akxtsz7Q9hnrhT+Caf0S3qBvS3HM6387WyItfHN4 esjp6WYCIWLT8UcwYv2O3Rs6hopUXFfh6SjohvyU1X2YdXXjaHWkhI9hIviVN6FmKKOb tNCg== X-Gm-Message-State: ALKqPwfFMxnwLSbTrXb1bz/WwBLRJT82356Ew5YCoZ11SbJrVrTZfPRn Yl8RXRbbPwT2UW4tEek5/z9EMvsNycQhc/g3qAyY8zY1UAY= X-Received: by 2002:adf:a0ea:: with SMTP id n39-v6mr3302833wrn.87.1527098735141; Wed, 23 May 2018 11:05:35 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a1c:160e:0:0:0:0:0 with HTTP; Wed, 23 May 2018 11:05:34 -0700 (PDT) In-Reply-To: <20180523113321.20404-1-mlichvar@redhat.com> References: <20180523113321.20404-1-mlichvar@redhat.com> From: John Stultz Date: Wed, 23 May 2018 11:05:34 -0700 Message-ID: Subject: Re: [PATCH RFC] timekeeping: Update multiplier when NTP frequency is set directly To: Miroslav Lichvar Cc: lkml , Thomas Gleixner , Richard Cochran , Prarit Bhargava Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 23, 2018 at 4:33 AM, Miroslav Lichvar 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. Thanks for the patch! I feel like we tried this years back, but had to revert it. But its been awhile. Am I confusing things? > diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c > index 49cbceef5deb..6922dae7317c 100644 > --- a/kernel/time/timekeeping.c > +++ b/kernel/time/timekeeping.c > @@ -2047,10 +2047,6 @@ void update_wall_time(void) > tk->tkr_mono.cycle_last, tk->tkr_mono.mask); > #endif > > - /* Check if there's really nothing to do */ > - if (offset < real_tk->cycle_interval) > - goto out; > - Apologies again, as I don't have a lot of context here these days, but this could mean we end up doing unnecessary work on every update_wall_time, no? Would a "force" flag be better to pass to update_wall_time() to only avoid the short-cut in the non-adjtimex case? thanks -john