mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
io_uring: conditional ->async_data allocation
There are opcodes that need ->async_data only in some cases and allocation it unconditionally may hurt performance. Add an option to opdef to make move the allocation part from the core io_uring to opcode specific code. Note, we can't just set opdef->async_size to zero because there are other helpers that rely on it, e.g. io_alloc_async_data(). Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/9dc62be9e88dd0ed63c48365340e8922d2498293.1661342812.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
53bdc88aac
commit
5916943943
2 changed files with 6 additions and 3 deletions
|
@ -1450,9 +1450,10 @@ int io_req_prep_async(struct io_kiocb *req)
|
||||||
return 0;
|
return 0;
|
||||||
if (WARN_ON_ONCE(req_has_async_data(req)))
|
if (WARN_ON_ONCE(req_has_async_data(req)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
if (io_alloc_async_data(req))
|
if (!io_op_defs[req->opcode].manual_alloc) {
|
||||||
return -EAGAIN;
|
if (io_alloc_async_data(req))
|
||||||
|
return -EAGAIN;
|
||||||
|
}
|
||||||
return def->prep_async(req);
|
return def->prep_async(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,8 @@ struct io_op_def {
|
||||||
unsigned ioprio : 1;
|
unsigned ioprio : 1;
|
||||||
/* supports iopoll */
|
/* supports iopoll */
|
||||||
unsigned iopoll : 1;
|
unsigned iopoll : 1;
|
||||||
|
/* opcode specific path will handle ->async_data allocation if needed */
|
||||||
|
unsigned manual_alloc : 1;
|
||||||
/* size of async data needed, if any */
|
/* size of async data needed, if any */
|
||||||
unsigned short async_size;
|
unsigned short async_size;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue