From: Pavel Begunkov <asml.silence@gmail.com>
To: Jens Axboe <axboe@kernel.dk>, io-uring <io-uring@vger.kernel.org>
Subject: Re: [PATCH for-next] io_uring/query: check for loops in in_query()
Date: Thu, 18 Sep 2025 11:27:03 +0100 [thread overview]
Message-ID: <253ba871-8795-4788-8db8-af743228b2d2@gmail.com> (raw)
In-Reply-To: <da6a8cb0-d726-48ea-8f10-2e5852e5acd3@kernel.dk>
On 9/16/25 19:33, Jens Axboe wrote:
> On 9/16/25 9:05 AM, Pavel Begunkov wrote:
>> I'd rather delay non fatal signals and even more so task work
>> processing, it can't ever be reliable in general case otherwise
>> and would always need to be executed in a loop. And the execution
>> should be brief, likely shorter than non-interruptible sections
>> of many syscalls. In this sense capping at 1000 can be a better
>> choice.
>
> Let's just cap it at 1000, at least that's a more reasonable number. I
> don't think there's a perfect way to solve this problem, outside of
> being able to detect loops, but at least 1000 can be documented as the
> max limit. Not that anyone would ever get anywhere near that...
Fwiw, I don't think the limit is strictly required as long as the
task remains killable, even if it's a nice thing to do. It's that
kind of problem that'd rather seem to come from a malicious user
and not a honest mistake, and in case of the latter it'd be hard
to make it nondeterministic. IOW, if the user tests the code, it
should be able to easily find and fix it.
>> You was pretty convincing insisting that extra waiting on teardown is
>> not tolerable. In the same spirit there were discussions on how fast
>> you can create rings. I wouldn't care if it's one or two extra
>> syscalls, but I reasonably expect that it might grow to low double
>> digit queries at some point, and 10-15 syscalls doesn't sound that
>> comfortable while that can be easily avoided.
>
> Those are completely different matters. The teardown slowness caused
> 100-150x slowdowns, doing 10-15 extra syscalls for setup is utter noise
Another worry is the possibility that the number of queries goes
considerably up. E.g. a query type that returns info about a
specified req opcode, and some library doing it for each opcode.
> and nobody would ever notice that, let alone complain about it. But I'm
> willing to compromise on some sane lower limit, even if I think the
> better API is just doing single queries at the time because that is the
> sanest API when we don't need to care about squeezing out the last bit
> of efficiency.
If you have a bunch of them, it might be neater from the user code
perspective as well instead of making multiple calls. I guess can
be abstracted out by a library, but struct layouts would need to
be smart.
--
Pavel Begunkov
prev parent reply other threads:[~2025-09-18 10:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-11 0:13 [PATCH for-next] io_uring/query: check for loops in in_query() Jens Axboe
2025-09-11 9:02 ` Pavel Begunkov
2025-09-11 11:40 ` Pavel Begunkov
2025-09-15 18:41 ` Jens Axboe
2025-09-16 15:05 ` Pavel Begunkov
2025-09-16 18:33 ` Jens Axboe
2025-09-16 18:35 ` Jens Axboe
2025-09-18 9:50 ` Pavel Begunkov
2025-09-18 10:27 ` Pavel Begunkov [this message]
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=253ba871-8795-4788-8db8-af743228b2d2@gmail.com \
--to=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=io-uring@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