From: Jeff Layton <jlayton@kernel.org>
To: Arnd Bergmann <arnd@kernel.org>, John Stultz <jstultz@google.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
Thomas Gleixner <tglx@linutronix.de>,
Stephen Boyd <sboyd@kernel.org>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel test robot <oliver.sang@intel.com>
Subject: Re: [PATCH] timekeeping: move multigrain ctime floor handling into timekeeper
Date: Thu, 12 Sep 2024 09:26:27 -0400 [thread overview]
Message-ID: <284fd6a654eaec5a45b78c9ee88cde7b543e2278.camel@kernel.org> (raw)
In-Reply-To: <b71c161a-8b43-400e-8c61-caac80e685a8@app.fastmail.com>
On Thu, 2024-09-12 at 13:17 +0000, Arnd Bergmann wrote:
> On Thu, Sep 12, 2024, at 11:34, Jeff Layton wrote:
> > On Thu, 2024-09-12 at 10:01 +0000, Arnd Bergmann wrote:
> > > On Wed, Sep 11, 2024, at 20:43, Jeff Layton wrote:
> > >
> > > That way you avoid the atomic64_try_cmpxchg()
> > > inode_set_ctime_current(), making that case faster,
> > > and avoid all overhead in coarse_ctime() unless you
> > > use both types during the same tick.
> > >
> >
> > With the current code we only get a fine grained timestamp iff:
> >
> > 1/ the timestamps have been queried (a'la I_CTIME_QUERIED)
> > 2/ the current coarse-grained or floor time would not show a change in
> > the ctime
> >
> > If we do what you're suggesting above, as soon as one task sets the
> > flag, anyone calling current_time() will end up getting a brand new
> > fine-grained timestamp, even when the current floor time would have
> > been fine.
>
> Right, I forgot about this part of your work, the
> I_CTIME_QUERIED logic definitely has to stay.
>
> > That means a lot more calls into ktime_get_real_ts64(), at least until
> > the timer ticks, and would probably mean a lot of extra journal
> > transactions, since those timestamps would all be distinct from one
> > another and would need to go to disk more often.
>
> I guess some of that overhead would go away if we just treated
> tk_xtime() as the floor value without an additional cache,
> and did the comparison against inode->i_ctime inside of
> a new ktime_get_real_ts64_newer_than(), but there is still the
> case of a single inode getting updated a lot, and it would
> break the ordering of updates between inodes.
>
Yes, and the breaking of ordering is why we had to revert the last set,
so that's definitely no good.
I think your suggestion about using a tuple of the sequence and the
delta should work. The trick is that we need to do the fetch and the
cmpxchg of the floor tuple inside the read_seqcount loop. Zeroing it
out can be done with write_once(). If we get a spurious update to the
floor while zeroing then it's no big deal since everything would just
loop and do it again.
I'll plan to hack something together later today and see how it does.
Thanks for the help so far!
--
Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2024-09-12 13:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-11 12:56 [PATCH] timekeeping: move multigrain ctime floor handling into timekeeper Jeff Layton
2024-09-11 19:55 ` John Stultz
2024-09-11 20:19 ` Arnd Bergmann
2024-09-11 20:43 ` Jeff Layton
2024-09-12 10:01 ` Arnd Bergmann
2024-09-12 11:34 ` Jeff Layton
2024-09-12 13:17 ` Arnd Bergmann
2024-09-12 13:26 ` Jeff Layton [this message]
2024-09-12 14:37 ` Jeff Layton
2024-09-12 16:51 ` Arnd Bergmann
2024-09-11 20:19 ` Jeff Layton
2024-09-12 12:31 ` Christian Brauner
2024-09-12 12:39 ` Jeff Layton
2024-09-12 12:43 ` Christian Brauner
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=284fd6a654eaec5a45b78c9ee88cde7b543e2278.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=arnd@kernel.org \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=jstultz@google.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oliver.sang@intel.com \
--cc=sboyd@kernel.org \
--cc=tglx@linutronix.de \
--cc=viro@zeniv.linux.org.uk \
/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