From: Linus Torvalds <torvalds@linux-foundation.org>
To: Jeff Layton <jlayton@kernel.org>
Cc: Amir Goldstein <amir73il@gmail.com>,
Christian Brauner <brauner@kernel.org>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Jan Kara <jack@suse.cz>, "Darrick J. Wong" <djwong@kernel.org>
Subject: Re: [GIT PULL v2] timestamp fixes
Date: Mon, 25 Sep 2023 09:02:36 -0700 [thread overview]
Message-ID: <CAHk-=wg1YhGmwcWn4TfTC1fMaDjhbLJMge123rj2YEjZNy5KFQ@mail.gmail.com> (raw)
In-Reply-To: <9ee3b65480b227102c04272d2219f366c65a14f3.camel@kernel.org>
On Mon, 25 Sept 2023 at 04:23, Jeff Layton <jlayton@kernel.org> wrote:
>
> The catch here is that we have at least some testcases that do things
> like set specific values in the mtime and atime, and then test that the
> same value is retrievable.
Yeah, I'm sure that happens. But as you say, we already have
per-filesystem granularity issues that means that there is some non-ns
granularity that those tests have to deal with.
Unless they currently just work on one or two filesystems, of course.
> Of course, that set truncates the values at jiffies granularity (~4ms on
> my box). That's well above 100ns, so it's possible that's too coarse for
> us to handwave this problem away.
Note that depending or enforcing some kind of jiffies granularity is
*particularly* bad, because it's basically a random value.
It will depend on architecture and on configuration. On some
architectures it's a fixed value (some have it at 100, which is, I
think, the original x86 case), on others it's "configurable", but not
really (ie alpha is "configurable" in our Kconfig, but the _hardware_
typically has a fixed clock tick at 1024 Hz, but then there are
platforms that are different, and then there's Qemu that likes a lower
frequency to avoid overhead etc etc).
And then we have the "modern default", which is to ask the user at
config time if they want a 100 / 250 / 300 / 1000 HZ value, and the
actual hw clock tick may be much more dynamic than that.
Anyway, what I'm saying is just that we should *not* limit granularity
to anything that has to do with jiffies. Yes, that's still a real
thing in that it's a "cheap read of the current time", but it should
never be seen as any kind of vfs granularity.
And yes, HZ will be in the "roughly 100-1000" range, so if we're
talking granularities that are microseconds or finer, then at most
you'll have rounding issues - and since any HZ rounding issues should
only be for the cases where we set the time to "now" - rounding
shouldn't be an issue anyway, since it's not a time that is specified
by user space.
End result: try to avoid anything to do with HZ in filesystem code,
unless it's literally about jiffies (which should typically be mostly
about any timeouts a filesystem may have, not about timestamps
themselves).
Linus
next prev parent reply other threads:[~2023-09-25 16:03 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-21 11:20 [GIT PULL v2] timestamp fixes Christian Brauner
2023-09-21 18:24 ` Linus Torvalds
2023-09-21 18:51 ` Jeff Layton
2023-09-21 19:28 ` Linus Torvalds
2023-09-21 19:46 ` Linus Torvalds
2023-09-21 21:57 ` Jeff Layton
2023-09-22 12:28 ` Christian Brauner
2023-09-22 10:19 ` David Sterba
2023-09-23 6:36 ` Amir Goldstein
2023-09-23 17:48 ` Linus Torvalds
2023-09-23 19:30 ` Theodore Ts'o
2023-09-23 20:03 ` Linus Torvalds
2023-09-23 22:07 ` Theodore Ts'o
2023-09-23 23:31 ` Linus Torvalds
2023-09-23 21:29 ` Amir Goldstein
2023-09-24 10:26 ` Christian Brauner
2023-09-25 11:22 ` Jeff Layton
2023-09-25 16:02 ` Linus Torvalds [this message]
2023-09-22 12:24 ` Christian Brauner
2023-09-24 8:34 ` Amir Goldstein
2023-09-24 10:15 ` Christian Brauner
2023-09-22 12:16 ` Christian Brauner
2023-09-21 20:10 ` pr-tracker-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAHk-=wg1YhGmwcWn4TfTC1fMaDjhbLJMge123rj2YEjZNy5KFQ@mail.gmail.com' \
--to=torvalds@linux-foundation.org \
--cc=amir73il@gmail.com \
--cc=brauner@kernel.org \
--cc=djwong@kernel.org \
--cc=jack@suse.cz \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).