mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 03:23:53 -04:00
io_uring/cmd: add iovec cache for commands
Add iou_vec to commands and wire caching for it, but don't expose it to users just yet. We need the vec cleared on initial alloc, but since we can't place it at the beginning at the moment, zero the entire async_data. It's cached, and the performance effects only the initial allocation, and it might be not a bad idea since we're exposing those bits to outside drivers. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/c0f2145b75791bc6106eb4e72add2cf6a2c72a7a.1742579999.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
committed by
Jens Axboe
parent
5f14404bfa
commit
3a4689ac10
@@ -16,6 +16,14 @@
|
||||
#include "rsrc.h"
|
||||
#include "uring_cmd.h"
|
||||
|
||||
void io_cmd_cache_free(const void *entry)
|
||||
{
|
||||
struct io_async_cmd *ac = (struct io_async_cmd *)entry;
|
||||
|
||||
io_vec_free(&ac->vec);
|
||||
kfree(ac);
|
||||
}
|
||||
|
||||
static void io_req_uring_cleanup(struct io_kiocb *req, unsigned int issue_flags)
|
||||
{
|
||||
struct io_uring_cmd *ioucmd = io_kiocb_to_cmd(req, struct io_uring_cmd);
|
||||
@@ -29,13 +37,23 @@ static void io_req_uring_cleanup(struct io_kiocb *req, unsigned int issue_flags)
|
||||
|
||||
if (issue_flags & IO_URING_F_UNLOCKED)
|
||||
return;
|
||||
|
||||
io_alloc_cache_vec_kasan(&ac->vec);
|
||||
if (ac->vec.nr > IO_VEC_CACHE_SOFT_CAP)
|
||||
io_vec_free(&ac->vec);
|
||||
|
||||
if (io_alloc_cache_put(&req->ctx->cmd_cache, cache)) {
|
||||
ioucmd->sqe = NULL;
|
||||
req->async_data = NULL;
|
||||
req->flags &= ~REQ_F_ASYNC_DATA;
|
||||
req->flags &= ~(REQ_F_ASYNC_DATA|REQ_F_NEED_CLEANUP);
|
||||
}
|
||||
}
|
||||
|
||||
void io_uring_cmd_cleanup(struct io_kiocb *req)
|
||||
{
|
||||
io_req_uring_cleanup(req, 0);
|
||||
}
|
||||
|
||||
bool io_uring_try_cancel_uring_cmd(struct io_ring_ctx *ctx,
|
||||
struct io_uring_task *tctx, bool cancel_all)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user