From: Pavel Begunkov <asml.silence@gmail.com>
To: Jens Axboe <axboe@kernel.dk>, Stefan Metzmacher <metze@samba.org>,
io-uring@vger.kernel.org
Cc: Keith Busch <kbusch@kernel.org>
Subject: Re: [PATCH v2 2/2] io_uring/timeout: immediate timeout arg
Date: Fri, 27 Feb 2026 21:09:30 +0000 [thread overview]
Message-ID: <cc9ba4b8-88f1-48c9-8aae-fe30a6b5c282@gmail.com> (raw)
In-Reply-To: <2daa9b01-d989-4922-b892-e7f3f06297ac@kernel.dk>
On 2/27/26 20:19, Jens Axboe wrote:
> On 2/27/26 1:03 PM, Pavel Begunkov wrote:
>> On 2/27/26 19:39, Jens Axboe wrote:
...
>>> I don't think it's about length of it - if you can avoid the div by
>>> doing ns_to_timespec64(), that might be very useful? Would make
>>
>> hrtimer_start(&data->timer, timespec64_to_ktime(data->ts), mode);
>> ^^^
>>
>> io_uring just needs to flip it and use ktime, but I left it for later.
>
> I think we should go all the way with this if we're doing the immediate
> mode. And I do think that is a good idea. Doing a half-way thing doesn't
> make much sense to me.
One time people will tell you don't do premature optimisations,
merge the main thing first, another time it's the other way around,
you can never guess.
In either case, it's useful by itself. Div is not that expensive
to be a break dealer, and div by constant will usually get
replaced with a mul by modern compilers.
>>> userspace simpler too potentially, and basically make the immediate mode
>>> _exactly_ the same as the non-immediate mode, it just delivers the
>>> __kernel_timespec in a different way.
>>
>> I very much want to believe that everything about kernel_timespec has
>> some deep meaning, but I fail to see why they split it as sec/ns and
>> left invalid ranges for ns, why ns is signed, and why even after a
>> large revamp one of the fields doesn't use a fixed width type.
>> I'm not sure exactly like it is actually a good idea.
>
> But that's the API for anything timing related, whether it be timeval,
> timespec, or __kernel_timespec the latter obviously only existing
> because everybody else could not be bothered to do a proper 32 vs 64-bit
> agnostic type before. Hence that's the API that people know and use,
> there's no deeper meaning other than that. And I agree, it's kind of
> crap in how you can have an invalid range and it gets masked.
>
> It's like like I'm a huge __kernel_timespec fan, but for consistency's
> sake, I do like it. With a clock source, then it does start to make
> sense.
What's about clock source? I'm curious
> Not that I think there's a lot of ABS use cases, I'd expect
> relative to be what people generally use here. But at least then the
It's probably common enough. Not the "wake me on Monday at 5am" kind,
but rather get the current time and then recalculating intervals
from it. Would be nice to return the wake up time as well in a CQE,
if only it was free.
> IMMED API addition will just work regardless of what you do in the app.
> That's better than someone a few revisions later than saying "hey that's
> cool, can we do ABS too which I use because of X and Y" and then having
> to hack that on top.
Hack it up in the user program? I didn't get it.
--
Pavel Begunkov
next prev parent reply other threads:[~2026-02-27 21:09 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-25 10:35 [PATCH v2 0/2] timeout immediate arg Pavel Begunkov
2026-02-25 10:35 ` [PATCH v2 1/2] io_uring/timeout: READ_ONCE sqe->addr Pavel Begunkov
2026-02-25 10:35 ` [PATCH v2 2/2] io_uring/timeout: immediate timeout arg Pavel Begunkov
2026-02-27 14:08 ` Stefan Metzmacher
2026-02-27 15:05 ` Jens Axboe
2026-02-27 16:17 ` Stefan Metzmacher
2026-02-27 16:21 ` Jens Axboe
2026-02-27 19:08 ` Pavel Begunkov
2026-02-27 19:39 ` Jens Axboe
2026-02-27 20:03 ` Pavel Begunkov
2026-02-27 20:19 ` Jens Axboe
2026-02-27 21:09 ` Pavel Begunkov [this message]
2026-02-27 21:17 ` Jens Axboe
2026-02-27 22:10 ` Pavel Begunkov
2026-02-27 22:19 ` Jens Axboe
2026-02-27 22:47 ` Pavel Begunkov
2026-02-25 15:36 ` (subset) [PATCH v2 0/2] timeout immediate arg Jens Axboe
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=cc9ba4b8-88f1-48c9-8aae-fe30a6b5c282@gmail.com \
--to=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=io-uring@vger.kernel.org \
--cc=kbusch@kernel.org \
--cc=metze@samba.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