diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2021-11-10 15:49:32 +0000 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-11-24 11:17:53 -0700 |
commit | 04c76b41ca974b508522831441dd7e5b1b59cbb0 (patch) | |
tree | 87224f4ea9ff50972592d97c2ce39f4901656f5e /fs/romfs | |
parent | 913a571affedd17239c4d4ea90c8874b32fc2191 (diff) | |
download | linux-stable-04c76b41ca974b508522831441dd7e5b1b59cbb0.tar.gz linux-stable-04c76b41ca974b508522831441dd7e5b1b59cbb0.tar.bz2 linux-stable-04c76b41ca974b508522831441dd7e5b1b59cbb0.zip |
io_uring: add option to skip CQE posting
Emitting a CQE is expensive from the kernel perspective. Often, it's
also not convenient for the userspace, spends some cycles on processing
and just complicates the logic. A similar problems goes for linked
requests, where we post an CQE for each request in the link.
Introduce a new flags, IOSQE_CQE_SKIP_SUCCESS, trying to help with it.
When set and a request completed successfully, it won't generate a CQE.
When fails, it produces an CQE, but all following linked requests will
be CQE-less, regardless whether they have IOSQE_CQE_SKIP_SUCCESS or not.
The notion of "fail" is the same as for link failing-cancellation, where
it's opcode dependent, and _usually_ result >= 0 is a success, but not
always.
Linked timeouts are a bit special. When the requests it's linked to was
not attempted to be executed, e.g. failing linked requests, it follows
the description above. Otherwise, whether a linked timeout will post a
completion or not solely depends on IOSQE_CQE_SKIP_SUCCESS of that
linked timeout request. Linked timeout never "fail" during execution, so
for them it's unconditional. It's expected for users to not really care
about the result of it but rely solely on the result of the master
request. Another reason for such a treatment is that it's racy, and the
timeout callback may be running awhile the master request posts its
completion.
use case 1:
If one doesn't care about results of some requests, e.g. normal
timeouts, just set IOSQE_CQE_SKIP_SUCCESS. Error result will still be
posted and need to be handled.
use case 2:
Set IOSQE_CQE_SKIP_SUCCESS for all requests of a link but the last,
and it'll post a completion only for the last one if everything goes
right, otherwise there will be one only one CQE for the first failed
request.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/0220fbe06f7cf99e6fc71b4297bb1cb6c0e89c2c.1636559119.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/romfs')
0 files changed, 0 insertions, 0 deletions