Message ID | 20181207134824.300024-8-arnd@arndb.de |
---|---|
State | Accepted |
Commit | d651d1607f22fd0cd249cb045627569f8028092b |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp521743ljp; Fri, 7 Dec 2018 05:49:48 -0800 (PST) X-Google-Smtp-Source: AFSGD/WTY+TlnOVsPKNT3yFEp4X7UyTtCNdXyB/L0Is5Xp7srbzJrsGoiuSRbaKM/stgeFQwKOzG X-Received: by 2002:a62:e0d8:: with SMTP id d85mr2291457pfm.214.1544190588073; Fri, 07 Dec 2018 05:49:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544190588; cv=none; d=google.com; s=arc-20160816; b=UonkuUKCP7FXN/LIzjyNuQZEaGFM5rczJVgSFKpLZ8W229/cDaLc5sXfmVm/sL/j5H hqt3NEJZZdWR7Iivk2O9Wug248udsR+kNJpSEJhysgoKHhTN5bgxurIJ1iK3viulA9m9 CMroSIRm0HhrVt8OlNI+nK2U6VPFaIromPcnq43xi537r/jUWUDUi7KC3bbwXqK2v0Dn 9mjyAZiOyX7iJZ4wN/WNU49VrEmlHRUdJaOpGGeZe48Fw8j3vzrZSFRguiVPk4iDNCfu acZhez/PJwNOHNIIlUtCqUNWiz1v8Zmw/8/3yHceOydw66ebCugexIqye1D5TzsvBMuw xaKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=h+ZZGgg4G7hoIRH8ukbKBM1p1qbTfAI6lHgga/1Y4Po=; b=PHiABUzh4xsoGMDzJCrxiX6J48ukNklSg3dx7Y9LRwQbNSBnzDDpwotV5IYUsLZDPr bT/VQzXR0e7fKc3ZTQ63d0w22UUG+TwaFHfq0vUmf51tfcaxSUuN7jOB5MU9LTxrVsAy J3wwtYkw0zcUIgKmwJqJVbW6talzkIDjEwMcRIVZWqmujFVH3y7pOmyBQ/MowV9P0Dv0 aGQmowoB5j6ScATtZxlLmaWjssHxOzpZ4Mhv/agiym2myT5zDjR/jVUkI/Fn2S0cakQV PtLeKEd5E/ATZPmZ8OWfpha6anhrhOyFirAe4TKCvWm4fDRasUm0ufPknUODHS5TAo/h J+MQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: <linux-kernel-owner@vger.kernel.org> Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l7si2883911pgk.169.2018.12.07.05.49.47; Fri, 07 Dec 2018 05:49:48 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726189AbeLGNtp (ORCPT <rfc822;igor.opaniuk@linaro.org> + 31 others); Fri, 7 Dec 2018 08:49:45 -0500 Received: from mout.kundenserver.de ([212.227.126.134]:46225 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726059AbeLGNt1 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 7 Dec 2018 08:49:27 -0500 Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MJmX3-1gkrXY12oj-00K5H1; Fri, 07 Dec 2018 14:49:01 +0100 From: Arnd Bergmann <arnd@arndb.de> To: y2038@lists.linaro.org Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-sh@vger.kernel.org, Baolin Wang <baolin.wang@linaro.org>, Andrew Morton <akpm@linux-foundation.org>, John Stultz <john.stultz@linaro.org>, Alexander Viro <viro@zeniv.linux.org.uk>, Thomas Gleixner <tglx@linutronix.de>, Rich Felker <dalias@libc.org>, Yoshinori Sato <ysato@users.sourceforge.jp>, Arnd Bergmann <arnd@arndb.de> Subject: [PATCH 7/8] vfs: replace current_kernel_time64 with ktime equivalent Date: Fri, 7 Dec 2018 14:48:23 +0100 Message-Id: <20181207134824.300024-8-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181207134824.300024-1-arnd@arndb.de> References: <20181207134824.300024-1-arnd@arndb.de> X-Provags-ID: V03:K1:/PWWtMTAj7kH3IX8FIHaCh0M4ZVgezPmBZs+fNsTAGU/xKCysp8 dL1kT65HFb01mnt9LbC25fw4I9taGCHDZ7iyww/h0B54yAz+S3XluCxtTq7JwLRpd3eP/Vk dLnCg79x8l7iPHfhhKj2XG91qvOvVX6MQ/Utqc/01ovw3KIOCZDZFDJCMqelq3kCPbHJSby UObdskdXz+J5ViYiPwYvA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:TN0H1/fwOtw=:By9RfTk590MZiC4vntyyQ5 fbOdGN36gwZf/zI0N7orC4+OfgmATkMGOmkFkS2OJLu7O5t7wFxEOYFlmxvffT+P6d9Y0oZNC NF+FfpOD9EsKrDfzRcasCYnHNWdt8dcOjGkNRfoNSuQVSpeAMaHpwPkY/RjMEFTu5PNzwRRgv ZoW1z+8yzUulzNHAn8jBNKY12QpJW/ezW2SrQujLhOdi6WpdCilcYRRFwJf+3wxoBHxcY7VrN dIu/bxnr2Mi+fPxTuIskLui2vx5kInvB7HOdRl2jvJiXKHtHrRUGnZmr9s1AJj4rJXzsya1FL jl3gX8KIBgd814Ioctnf9B954YWyNKFtVNoYdGGBQLAqJ2cjadjEeIbozCci/O8Fc9kzM+dxl Ec3BJq5dwFl8WfmxNuw2szW8x1/y4CQIYR2j0DPPdftEi9tEc8F5A9jaP13c9BFbqZX0nPO04 i2wLI0E9bLyeq3dg2s6+Aj3ocdxrcoovfe3rXmEo7GqYbhTxH1zQ1fVJZzq7IZW0M+MOsRU3N VYbSVh9jCX8OI5gOVOsQvCKSQ2FbZ+LtYSLM03oPtTub0PsGsAlAv6unS5WrvCOvAgr+PbfFe G4XN0tVvFhHtxSXmNPph+5fLUjAT6GMWp5y3mCZwHwVLZmiqTUbw+ftaGm1wlN722YtC/Nt7D VWjzjXIb5B0oWyhUvdIEwM2vfM6s57OxTjKjXKrPoZHz4fx6As958V2BHmggfrb90a97d7AyS SucssamhWShBmaN6UH++D5cPVBdLF3Wfe8cKtw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org |
Series |
timekeeping: cleanups
|
expand
|
diff --git a/fs/inode.c b/fs/inode.c index 9e198f00b64c..73432e64f874 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -2146,7 +2146,9 @@ EXPORT_SYMBOL(timespec64_trunc); */ struct timespec64 current_time(struct inode *inode) { - struct timespec64 now = current_kernel_time64(); + struct timespec64 now; + + ktime_get_coarse_real_ts64(&now); if (unlikely(!inode->i_sb)) { WARN(1, "current_time() called with uninitialized super_block in the inode");
current_time is the last remaining caller of current_kernel_time64(), which is a wrapper around ktime_get_coarse_real_ts64(). This calls the latter directly for consistency with the rest of the kernel that is moving to the ktime_get_ family of time accessors, as now documented in Documentation/core-api/timekeeping.rst. An open questions is whether we may want to actually call the more accurate ktime_get_real_ts64() for file systems that save high-resolution timestamps in their on-disk format. This would add a small overhead to each update of the inode stamps but lead to inode timestamps to actually have a usable resolution better than one jiffy (1 to 10 milliseconds normally). Experiments on a variety of hardware platforms show a typical time of around 100 CPU cycles to read the cycle counter and calculate the accurate time from that. On old platforms without a cycle counter, this can be signiciantly higher, up to several microseconds to access a hardware clock, but those have become very rare by now. I traced the original addition of the current_kernel_time() call to set the nanosecond fields back to linux-2.5.48, where Andi Kleen added a patch with subject "nanosecond stat timefields". Andi explains that the motivation was to introduce as little overhead as possible back then. At this time, reading the clock hardware was also more expensive when most architectures did not have a cycle counter. One side effect of having more accurate inode timestamp would be having to write out the inode every time that mtime/ctime/atime get touched on most systems, whereas many file systems today only write it when the timestamps have changed, i.e. at most once per jiffy unless something else changes as well. That change would certainly be noticed in some workloads, which is enough reason to not do it without a good reason, regardless of the cost of reading the time. One thing we could still consider however would be to round the timestamps from current_time() to multiples of NSEC_PER_JIFFY, e.g. full milliseconds rather than having six or seven meaningless but confusing digits at the end of the timestamp. Link: http://lkml.kernel.org/r/20180726130820.4174359-1-arnd@arndb.de Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- fs/inode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.18.0