From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8523BCDB485 for ; Wed, 18 Oct 2023 21:52:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 190E380050; Wed, 18 Oct 2023 17:52:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 141CD8D0016; Wed, 18 Oct 2023 17:52:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0099D80050; Wed, 18 Oct 2023 17:52:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id E5DF08D0016 for ; Wed, 18 Oct 2023 17:52:51 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id C3AEA1604D5 for ; Wed, 18 Oct 2023 21:52:51 +0000 (UTC) X-FDA: 81359932542.13.261F548 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf18.hostedemail.com (Postfix) with ESMTP id E1FC31C0003 for ; Wed, 18 Oct 2023 21:52:49 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=o6Q0dDst; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf18.hostedemail.com: domain of jlayton@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=jlayton@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1697665970; a=rsa-sha256; cv=none; b=uDt3PeeR7qXsmWxLPp3sRgx/kHtsGcWRzHKdHuUlDwNZNui48NT1q+SNtYT8lj0i4vBd23 mWD8WpicaSVXThQXw//OqZS37PEir2FW7C3AisfNk1L2fMkwmQ6/K3zslvDPwrPkaaW8vt 4r3HfLCmlOeW7rlTst7xQFAYyFf9FHw= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=o6Q0dDst; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf18.hostedemail.com: domain of jlayton@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=jlayton@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1697665970; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=CkSLX/J9r9Zp0qoVgTu3aOsEBPyrouNuIMGb2U337JA=; b=h3X6PP0Yy7D//JmtIWOdfWGvZOuNrxBWHOuKncmIA4uHC09GO2k1QUF9RJWPnmuHVN3zcz p32DXuSRJDuAu3WLz1pwsG9RHUcK0PlvS/0emBtEvep6Hsn5OXjSCPP4tQky9OXisGwY7S OyKU6uPoJA11RLKj4E4ZU4EFbKdEzfY= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id 33423B82506; Wed, 18 Oct 2023 21:52:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1335C433C7; Wed, 18 Oct 2023 21:52:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697665967; bh=TvWB9COV3obY2cRmOb+aflk7pQdFiGa+OAaSrwETeEg=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=o6Q0dDst3pq/rMdgcEn29wGOr+tB/JTAgagUCnU56jV7OWRmJc2hkL3p9bHJkpAk5 bBi0Z6MGrjmsLyeAMt2TCWzNkWQmkZanzskokbXQ4JY1Hek5WHmBttXyjyTwnJrQvQ BF5sIw6EON3aFSB+xQ+qbTxzcUZ0IR5ZVw5Vx+/YxRH0ZTZgBdtkm6sh/qjWIdz7AP 6tOdFsB64ry67vRYl2pUxG6vDUpPUIm2wMinWfSYg/1MigQVuYNI0W7C6ZPBBjUAS0 1j0o76eqA7TBI8aa+lP7BHgSNwMRRzxrphVbke3vh7niZzVFyi874ON8uDsDkVKwiP P1a4eT4ra12zA== Message-ID: <5f96e69d438ab96099bb67d16b77583c99911caa.camel@kernel.org> Subject: Re: [PATCH RFC 2/9] timekeeping: new interfaces for multigrain timestamp handing From: Jeff Layton To: Linus Torvalds Cc: Alexander Viro , Christian Brauner , John Stultz , Thomas Gleixner , Stephen Boyd , Chandan Babu R , "Darrick J. Wong" , Dave Chinner , Theodore Ts'o , Andreas Dilger , Chris Mason , Josef Bacik , David Sterba , Hugh Dickins , Andrew Morton , Amir Goldstein , Jan Kara , David Howells , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-mm@kvack.org, linux-nfs@vger.kernel.org Date: Wed, 18 Oct 2023 17:52:43 -0400 In-Reply-To: References: <20231018-mgtime-v1-0-4a7a97b1f482@kernel.org> <20231018-mgtime-v1-2-4a7a97b1f482@kernel.org> Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: E1FC31C0003 X-Stat-Signature: au3phw3jh1rftwmmn63hsizcbkuqwd9o X-HE-Tag: 1697665969-771282 X-HE-Meta: U2FsdGVkX18U6B3j+jVOifbbIgfpCgovlJShabZX/8tpGl9qf/sMvJUU5cHCurMnunDoi6kotO1qjwJlpn0wpPPtoAp8s3kIKmG5KML1q2Z8Gtg9YfiepifwrhqRSVmkvMsyGr8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XbiJfKqIf7XoMg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, 2023-10-18 at 14:31 -0700, Linus Torvalds wrote: > On Wed, 18 Oct 2023 at 13:47, Jeff Layton wrote: > >=20 > > > old_ctime_nsec &=3D ~I_CTIME_QUERIED; > > > if (ts64.tv_nsec > old_ctime_nsec + inode->i_sb->s_time_gran) > > > return ts64; > > >=20 > >=20 > > Does that really do what you expect here? current_time will return a > > value that has already been through timestamp_truncate. >=20 > Yeah, you're right. >=20 > I think you can actually remove the s_time_gran addition. Both the > old_ctime_nsec and the current ts64,tv_nsec are already rounded, so > just doing >=20 > if (ts64.tv_nsec > old_ctime_nsec) > return ts64; >=20 > would already guarantee that it's different enough. >=20 Yep, and that's basically what inode_set_ctime_current does (though it does a timespec64 comparison). > > current_mgtime is calling ktime_get_real_ts64, which is an existing > > interface that does not take the global spinlock and won't advance the > > global offset. That call should be quite cheap. >=20 > Ahh, I did indeed mis-read that as the new one with the lock. >=20 > I did react to the fact that is_mgtime(inode) itself is horribly > expensive if it's not cached (following three quite possibly cold > pointers), which was part of that whole "look at I_CTIME_QUERIED > instead". > > I see the pointer chasing as a huge VFS timesink in all my profiles, > although usually it's the disgusting security pointer (because selinux > creates separate security nodes for each inode, even when the contents > are often identical). So I'm a bit sensitive to "follow several > pointers from 'struct inode'" patterns from looking at too many > instruction profiles. That's a very good point. I'll see if I can get rid of that (and maybe some other mgtime flag checks) before I send the next version.=20 Back to your earlier point though: Is a global offset really a non-starter? I can see about doing something per-superblock, but ktime_get_mg_coarse_ts64 should be roughly as cheap as ktime_get_coarse_ts64. I don't see the downside there for the non- multigrain filesystems to call that. On another note: maybe I need to put this behind a Kconfig option initially too? --=20 Jeff Layton