diff options
author | 2024-10-26 10:46:10 -0600 | |
---|---|---|
committer | 2024-11-02 15:44:30 -0600 | |
commit | f38f2847646f8be29a8fcb722e8b1dc8c8cb3924 (patch) | |
tree | cc7579041ea91589187121ff45cd43977ac79f17 /io_uring/io_uring.c | |
parent | io_uring/rsrc: add an empty io_rsrc_node for sparse buffer entries (diff) | |
download | wireguard-linux-f38f2847646f8be29a8fcb722e8b1dc8c8cb3924.tar.xz wireguard-linux-f38f2847646f8be29a8fcb722e8b1dc8c8cb3924.zip |
io_uring: only initialize io_kiocb rsrc_nodes when needed
Add the empty node initializing to the preinit part of the io_kiocb
allocation, and reset them if they have been used.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/io_uring.c')
-rw-r--r-- | io_uring/io_uring.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 9282d5fa45d3..60c947114fa3 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -947,6 +947,8 @@ void io_req_defer_failed(struct io_kiocb *req, s32 res) static void io_preinit_req(struct io_kiocb *req, struct io_ring_ctx *ctx) { req->ctx = ctx; + req->rsrc_nodes[IORING_RSRC_FILE] = rsrc_empty_node; + req->rsrc_nodes[IORING_RSRC_BUFFER] = rsrc_empty_node; req->link = NULL; req->async_data = NULL; /* not necessary, but safer to zero */ @@ -2032,8 +2034,6 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req, req->flags = (__force io_req_flags_t) sqe_flags; req->cqe.user_data = READ_ONCE(sqe->user_data); req->file = NULL; - req->rsrc_nodes[IORING_RSRC_FILE] = rsrc_empty_node; - req->rsrc_nodes[IORING_RSRC_BUFFER] = rsrc_empty_node; req->task = current; req->cancel_seq_set = false; |