public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@kernel.org>
To: "John Stultz" <jstultz@google.com>, "Jeff Layton" <jlayton@kernel.org>
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: Wed, 11 Sep 2024 20:19:17 +0000	[thread overview]
Message-ID: <d6fe52c2-bc9e-424f-a44e-cfc3f4044443@app.fastmail.com> (raw)
In-Reply-To: <CANDhNCpmZO1LTCDXzi-GZ6XkvD5w3ci6aCj61-yP6FJZgXj2RA@mail.gmail.com>

On Wed, Sep 11, 2024, at 19:55, John Stultz wrote:
>> diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
>> index 5391e4167d60..56b979471c6a 100644

> My confusion comes from the fact it seems like that would mean you
> have to do all your timestamping with CLOCK_MONOTONIC (so you have a
> useful floor value that you're keeping), so I'm not sure I understand
> the utility of returning CLOCK_REALTIME values. I guess I don't quite
> see the logic where the floor value is updated here, so I'm guessing.

I think we could take this further and store the floor value
in the timekeeper itself rather than in a global variable
next to the caller.

And instead of storing the absolute floor value, it would
be enough to store the delta since the previous
update_wall_time(), which in turn can get updated by a
variant of ktime_get_real_ts64() and reset to zero during
update_wall_time().

That way the coarse function only gains a call to
timespec64_add_ns() over the traditional version, and the
fine-grained version needs to atomically update that value.
If the delta value has to be a 64-bit integer, there also
needs to be some serialization of the reader side, but I
think that can be done with read_seqcount_begin() .

      Arnd

  reply	other threads:[~2024-09-11 20:19 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 [this message]
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
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=d6fe52c2-bc9e-424f-a44e-cfc3f4044443@app.fastmail.com \
    --to=arnd@kernel.org \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=jlayton@kernel.org \
    --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