Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp164966rwl; Tue, 11 Apr 2023 16:15:43 -0700 (PDT) X-Google-Smtp-Source: AKy350ZNE1zn9/Q0M6IYg3UsZMQ7aaXlDfRU+ddJibLObjGj5CElvMWGT1E5JEVNzujpvq5mJeCT X-Received: by 2002:a17:90a:e7c7:b0:23b:bf03:397e with SMTP id kb7-20020a17090ae7c700b0023bbf03397emr15862177pjb.24.1681254943493; Tue, 11 Apr 2023 16:15:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681254943; cv=none; d=google.com; s=arc-20160816; b=R2GJBIAzizSjPEpU8eRwuamxplRpKVWSYZG5ysNxUI+63Q5+rRqCkd8J+ngDp7VIMZ 1BOlEJO6OIqQaABMYP1uyDHmWJHI3s99Imd70/tmmCo2zaBZFWrSYSBlJO9hRlQzUe9J lTVnyiNP+yNA4NJBr20o6t/VZFL3bT5eXFMmlejmzH8xvPmI6PErg72kcOBkTe1oT6TD 8bZ5MsahGKwpygzWKoC55EYxQkPNfSYHB2zHB1QeoADKNJUDmOCw0XUp5bskGFA6YWR7 5bUesxSnIdJt0nFSuj4c1tqH6YRTw5QUK8f5AZv8F2XEXTwmefCd6QjzHzYnGOenHKkv vKUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=cm7n7h0+YQqhaMN60giOfNLEV6DHkhKIhtK3vaJrO+s=; b=sXRxT7GIV+B3VapvdxApDbmwdxCQzfCaV2EpNMaElDc1FQ9M3Fs7zGmFeA5Y8K/jej 6WvRMs0Vx1xVLkfO6gUvzOMkTYt6wILTG9ApizbGAoxnLeqjc3nKo6faLkygcirGyYS0 0OMJTqm2w0VEN0/P+R4pTHK7Rekon/7hfLFLBLOvzWY83tz9sqLJLvGGDAgJiQ5O4KZe IjMjyz9/8wVHLUhCFgUI+9Eik25AAUWMaaZxlbxvE1780Kap1O/ut6vRUrNeQHnYI1FD TZFi80ShBuwPire8hIZoyCNeQ4PZi6t+b0f8OvFEuFtBXCBy705tFf9WG6vYTeSBrnIh KsSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fromorbit-com.20210112.gappssmtp.com header.s=20210112 header.b=UBHxzOgx; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fromorbit.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d13-20020a17090a3b0d00b002467ae12b2esi341227pjc.20.2023.04.11.16.15.22; Tue, 11 Apr 2023 16:15:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@fromorbit-com.20210112.gappssmtp.com header.s=20210112 header.b=UBHxzOgx; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fromorbit.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229522AbjDKXNw (ORCPT + 99 others); Tue, 11 Apr 2023 19:13:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229604AbjDKXNv (ORCPT ); Tue, 11 Apr 2023 19:13:51 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F3E0173E for ; Tue, 11 Apr 2023 16:13:49 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id y11-20020a17090a600b00b0024693e96b58so8613648pji.1 for ; Tue, 11 Apr 2023 16:13:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fromorbit-com.20210112.gappssmtp.com; s=20210112; t=1681254829; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=cm7n7h0+YQqhaMN60giOfNLEV6DHkhKIhtK3vaJrO+s=; b=UBHxzOgxwXGsNLNd5A9P7VT4b7Po+zYBdXSmczVUbcnEawjNUyc6Q0yDVbqcVgbHAg QTmK+YIBP35K5pUYpip9sBXhtyUf3gX81/VeiKVT9jXLZfpHY4YVEyyU98F+6x0du6WZ 0zcsJKBeXD/aW3FwNY4xrZy9lJPBMYsetXsgXCawQz79UCg/xkbw2C6P4uSHEP5b0LeH Yp4N8YFsCKela8bX7OHmf/BCOT0KrvQlxQBmDffLwLAoPcYTSBOAI1r/FXscGJF4uU+I h84W2aDFzxwDHnMk2PUzMcRvbOJzzT7/wuUQYX4/fg8IeZhrkFXJLIAckBOjX9w41HXp ooow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681254829; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=cm7n7h0+YQqhaMN60giOfNLEV6DHkhKIhtK3vaJrO+s=; b=42BZJan8OEAZUbxvEqM4bEhtYtDzHIi0xQC8DbgmPzzRhmmnE16PIZK0e7NIJSJGns IpZVK0WhdUwida7Gzi2f5p79mVOeZB/OW0FUAYynmQe2gZsuk0TeSciX/WF/IHCPyY0r L7xeqV25nCeHT3HrZfKG+zQnxYGmWmUX1hGvq5XXvWdt61dvb4iX1FSPWXPmBhW2kGZc RYMN6XBLszDzNJJLic9YkwDxgzJxdmx8zxVLOGfgNb29hy2ApdNef3Za15NCpOcqZe7j LUaxcwshh3yhr1uZ5myfbspVmNQYsA0ITxnkKBReebd0UC9zs3v9G6Mc2l2JUyVyZiQA eOsA== X-Gm-Message-State: AAQBX9eTqV//CIEpKdh6Uec/8bR+O/f6lVTRIQOTBZIGd64Ws+eU2EKP 5NdVEMAimS+HH/l0sIRcG6ogdA== X-Received: by 2002:a17:90a:6b09:b0:23d:16d6:2f05 with SMTP id v9-20020a17090a6b0900b0023d16d62f05mr17621391pjj.22.1681254828818; Tue, 11 Apr 2023 16:13:48 -0700 (PDT) Received: from dread.disaster.area (pa49-180-41-174.pa.nsw.optusnet.com.au. [49.180.41.174]) by smtp.gmail.com with ESMTPSA id jh6-20020a170903328600b001a64011899asm330544plb.25.2023.04.11.16.13.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Apr 2023 16:13:48 -0700 (PDT) Received: from dave by dread.disaster.area with local (Exim 4.92.3) (envelope-from ) id 1pmNBJ-002H1W-AF; Wed, 12 Apr 2023 09:13:45 +1000 Date: Wed, 12 Apr 2023 09:13:45 +1000 From: Dave Chinner To: Jeff Layton Cc: Alexander Viro , Christian Brauner , "Darrick J. Wong" , Hugh Dickins , Andrew Morton , Chuck Lever , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-mm@kvack.org, linux-nfs@vger.kernel.org Subject: Re: [RFC PATCH 0/3][RESEND] fs: opportunistic high-res file timestamps Message-ID: <20230411231345.GB3223426@dread.disaster.area> References: <20230411143702.64495-1-jlayton@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230411143702.64495-1-jlayton@kernel.org> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Tue, Apr 11, 2023 at 10:36:59AM -0400, Jeff Layton wrote: > (Apologies for the resend, but I didn't send this with a wide enough > distribution list originally). > > A few weeks ago, during one of the discussions around i_version, Dave > Chinner wrote this: > > "You've missed the part where I suggested lifting the "nfsd sampled > i_version" state into an inode state flag rather than hiding it in > the i_version field. At that point, we could optimise away the > secondary ctime updates just like you are proposing we do with the > i_version updates. Further, we could also use that state it to > decide whether we need to use high resolution timestamps when > recording ctime updates - if the nfsd has not sampled the > ctime/i_version, we don't need high res timestamps to be recorded > for ctime...." > > While I don't think we can practically optimize away ctime updates > like we do with i_version, I do like the idea of using this scheme to > indicate when we need to use a high-res timestamp. > > This patchset is a first stab at a scheme to do this. It declares a new > i_state flag for this purpose and adds two new vfs-layer functions to > implement conditional high-res timestamp fetching. It then converts both > tmpfs and xfs to use it. > > This seems to behave fine under xfstests, but I haven't yet done > any performance testing with it. I wouldn't expect it to create huge > regressions though since we're only grabbing high res timestamps after > each query. > > I like this scheme because we can potentially convert any filesystem to > use it. No special storage requirements like with i_version field. I > think it'd potentially improve NFS cache coherency with a whole swath of > exportable filesystems, and helps out NFSv3 too. > > This is really just a proof-of-concept. There are a number of things we > could change: > > 1/ We could use the top bit in the tv_sec field as the flag. That'd give > us different flags for ctime and mtime. We also wouldn't need to use > a spinlock. > > 2/ We could probably optimize away the high-res timestamp fetch in more > cases. Basically, always do a coarse-grained ts fetch and only fetch > the high-res ts when the QUERIED flag is set and the existing time > hasn't changed. > > If this approach looks reasonable, I'll plan to start working on > converting more filesystems. Seems reasonable to me. In terms of testing, I suspect the main impact is going to be the additionaly overhead of taking a spinlock in normal stat calls. In which case, testing common tools like giti would be useful. e.g. `git status` runs about 170k stat calls on a typical kernel tree. If anything is going to be noticed by users that actually care, it'll be workloads like this... If we manage to elide the spinlock altogether, then I don't think we're going to be able to measure any sort perf difference on modern hardware short of high end NFS benchmarks that drive servers to their CPU usage limits.... > One thing I'm not clear on is how widely available high res timestamps > are. Is this something we need to gate on particular CONFIG_* options? Don't think so - the kernel should always provide the highest resoultion it can through the get_time interfaces - the _coarse variants simple return what was read from the high res timer at the last scheduler tick, hence avoiding the hardware timer overhead when high res timer resolution is not needed..... Cheers, Dave. -- Dave Chinner david@fromorbit.com