io_uring: add support for ignoring inline completions for waits
authorJens Axboe <axboe@kernel.dk>
Mon, 14 Oct 2024 20:04:00 +0000 (14:04 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 15 Oct 2024 13:41:20 +0000 (07:41 -0600)
commit8edad1ee317bda855678951bcbb6aede3eee3c05
tree9ac76c29a22ae5968d13e7c4bcaed3f2f390d79e
parentcf03f6eabbd136e2a950d4ba97b6a4457c2d7ae3
io_uring: add support for ignoring inline completions for waits

io_uring treats all completions the same - they post a completion event,
or more, and anyone waiting on event completions will see each event as
it gets posted.

However, some events may be more interesting than others. For a request
and response type model, it's not uncommon to have send/write events
that are submitted with a recv/read type of request. While the app does
want to see a successful send/write completion eventually, it need not
handle it upfront as it would want to do with a recv/read, as it isn't
time sensitive. Generally, a send/write completion will just mean that
a buffer can get recycled/reused, whereas a recv/read completion needs
acting upon (and a response sent).

This can be somewhat tricky to handle if many requests and responses
are being handled, and the app generally needs to track the number of
pending sends/writes to be able to sanely wait on just new incoming
recv/read requests. And even with that, an application would still
like to see a completion for a short/failed send/write immediately.

Add infrastructure to account inline completions, such that they can
be deducted from the 'wait_nr' being passed in via a submit_and_wait()
type of situation. Inline completions are ones that complete directly
inline from submission, such as a send to a socket where there's
enough space to accomodate the data being sent.

No functional changes in this patch, as no opcode supports setting
REQ_F_IGNORE_INLINE just yet.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/linux/io_uring_types.h
include/uapi/linux/io_uring.h
io_uring/io_uring.c
io_uring/io_uring.h