io_uring/kbuf: check for ring provided buffers first in recycling io_uring-buf-list
authorJens Axboe <axboe@kernel.dk>
Thu, 21 Aug 2025 01:41:28 +0000 (19:41 -0600)
committerJens Axboe <axboe@kernel.dk>
Thu, 21 Aug 2025 01:41:28 +0000 (19:41 -0600)
This is the most likely of paths if a provided buffer is used, so offer
it up first and push the legacy buffers to later.

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

index 1a539969fc9c36a983a2cee8398a224336002487..32f73adbe1e9ec957c9b4eab0cd4450480b9e542 100644 (file)
@@ -129,10 +129,10 @@ static inline bool io_kbuf_recycle(struct io_kiocb *req, struct io_buffer_list *
 {
        if (req->flags & REQ_F_BL_NO_RECYCLE)
                return false;
-       if (req->flags & REQ_F_BUFFER_SELECTED)
-               return io_kbuf_recycle_legacy(req, issue_flags);
        if (req->flags & REQ_F_BUFFER_RING)
                return io_kbuf_recycle_ring(req, bl);
+       if (req->flags & REQ_F_BUFFER_SELECTED)
+               return io_kbuf_recycle_legacy(req, issue_flags);
        return false;
 }