]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
io_uring: avoid req->ctx reload in io_req_put_rsrc_nodes()
authorJens Axboe <axboe@kernel.dk>
Tue, 17 Mar 2026 20:28:44 +0000 (14:28 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 17 Mar 2026 20:35:00 +0000 (14:35 -0600)
Cache 'ctx' to avoid it needing to get potentially reloaded.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/io_uring.c

index d703f0a8b315b3fb8280acd582282e3123297772..6eaa21e094698e02864c8fe93b7de5fe08d36a07 100644 (file)
@@ -1073,12 +1073,14 @@ void io_queue_next(struct io_kiocb *req)
 
 static inline void io_req_put_rsrc_nodes(struct io_kiocb *req)
 {
+       struct io_ring_ctx *ctx = req->ctx;
+
        if (req->file_node) {
-               io_put_rsrc_node(req->ctx, req->file_node);
+               io_put_rsrc_node(ctx, req->file_node);
                req->file_node = NULL;
        }
        if (req->flags & REQ_F_BUF_NODE)
-               io_put_rsrc_node(req->ctx, req->buf_node);
+               io_put_rsrc_node(ctx, req->buf_node);
 }
 
 static void io_free_batch_list(struct io_ring_ctx *ctx,