Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

io_uring/kbuf: drop 'issue_flags' from io_put_kbuf(s)() arguments

Picking multiple buffers always requires the ring lock to be held across
the operation, so there's no need to pass in the issue_flags to
io_put_kbufs(). On the single buffer side, if the initial picking of a
ring buffer was unlocked, then it will have been committed already. For
legacy buffers, no locking is required, as they will simply be freed.

Link: https://lore.kernel.org/r/20250821020750.598432-3-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>

Jens Axboe 5e73b402 ab3ea6ea

+14 -17
+1 -1
io_uring/io_uring.c
··· 1007 1007 lockdep_assert_held(&req->ctx->uring_lock); 1008 1008 1009 1009 req_set_fail(req); 1010 - io_req_set_res(req, res, io_put_kbuf(req, res, IO_URING_F_UNLOCKED)); 1010 + io_req_set_res(req, res, io_put_kbuf(req, res)); 1011 1011 if (def->fail) 1012 1012 def->fail(req); 1013 1013 io_req_complete_defer(req);
+2 -3
io_uring/kbuf.h
··· 121 121 return false; 122 122 } 123 123 124 - static inline unsigned int io_put_kbuf(struct io_kiocb *req, int len, 125 - unsigned issue_flags) 124 + static inline unsigned int io_put_kbuf(struct io_kiocb *req, int len) 126 125 { 127 126 if (!(req->flags & (REQ_F_BUFFER_RING | REQ_F_BUFFER_SELECTED))) 128 127 return 0; ··· 129 130 } 130 131 131 132 static inline unsigned int io_put_kbufs(struct io_kiocb *req, int len, 132 - int nbufs, unsigned issue_flags) 133 + int nbufs) 133 134 { 134 135 if (!(req->flags & (REQ_F_BUFFER_RING | REQ_F_BUFFER_SELECTED))) 135 136 return 0;
+6 -8
io_uring/net.c
··· 504 504 } 505 505 506 506 static inline bool io_send_finish(struct io_kiocb *req, int *ret, 507 - struct io_async_msghdr *kmsg, 508 - unsigned issue_flags) 507 + struct io_async_msghdr *kmsg) 509 508 { 510 509 struct io_sr_msg *sr = io_kiocb_to_cmd(req, struct io_sr_msg); 511 510 bool bundle_finished = *ret <= 0; 512 511 unsigned int cflags; 513 512 514 513 if (!(sr->flags & IORING_RECVSEND_BUNDLE)) { 515 - cflags = io_put_kbuf(req, *ret, issue_flags); 514 + cflags = io_put_kbuf(req, *ret); 516 515 goto finish; 517 516 } 518 517 519 - cflags = io_put_kbufs(req, *ret, io_bundle_nbufs(kmsg, *ret), issue_flags); 518 + cflags = io_put_kbufs(req, *ret, io_bundle_nbufs(kmsg, *ret)); 520 519 521 520 if (bundle_finished || req->flags & REQ_F_BL_EMPTY) 522 521 goto finish; ··· 692 693 else if (sr->done_io) 693 694 ret = sr->done_io; 694 695 695 - if (!io_send_finish(req, &ret, kmsg, issue_flags)) 696 + if (!io_send_finish(req, &ret, kmsg)) 696 697 goto retry_bundle; 697 698 698 699 io_req_msg_cleanup(req, issue_flags); ··· 871 872 if (sr->flags & IORING_RECVSEND_BUNDLE) { 872 873 size_t this_ret = *ret - sr->done_io; 873 874 874 - cflags |= io_put_kbufs(req, this_ret, io_bundle_nbufs(kmsg, this_ret), 875 - issue_flags); 875 + cflags |= io_put_kbufs(req, this_ret, io_bundle_nbufs(kmsg, this_ret)); 876 876 if (sr->flags & IORING_RECV_RETRY) 877 877 cflags = req->cqe.flags | (cflags & CQE_F_MASK); 878 878 if (sr->mshot_len && *ret >= sr->mshot_len) ··· 893 895 return false; 894 896 } 895 897 } else { 896 - cflags |= io_put_kbuf(req, *ret, issue_flags); 898 + cflags |= io_put_kbuf(req, *ret); 897 899 } 898 900 899 901 /*
+5 -5
io_uring/rw.c
··· 576 576 io_req_io_end(req); 577 577 578 578 if (req->flags & (REQ_F_BUFFER_SELECTED|REQ_F_BUFFER_RING)) 579 - req->cqe.flags |= io_put_kbuf(req, req->cqe.res, 0); 579 + req->cqe.flags |= io_put_kbuf(req, req->cqe.res); 580 580 581 581 io_req_rw_cleanup(req, 0); 582 582 io_req_task_complete(req, tw); ··· 659 659 * from the submission path. 660 660 */ 661 661 io_req_io_end(req); 662 - io_req_set_res(req, final_ret, io_put_kbuf(req, ret, issue_flags)); 662 + io_req_set_res(req, final_ret, io_put_kbuf(req, ret)); 663 663 io_req_rw_cleanup(req, issue_flags); 664 664 return IOU_COMPLETE; 665 665 } else { ··· 1057 1057 if (ret < 0) 1058 1058 req_set_fail(req); 1059 1059 } else if (!(req->flags & REQ_F_APOLL_MULTISHOT)) { 1060 - cflags = io_put_kbuf(req, ret, issue_flags); 1060 + cflags = io_put_kbuf(req, ret); 1061 1061 } else { 1062 1062 /* 1063 1063 * Any successful return value will keep the multishot read ··· 1065 1065 * we fail to post a CQE, or multishot is no longer set, then 1066 1066 * jump to the termination path. This request is then done. 1067 1067 */ 1068 - cflags = io_put_kbuf(req, ret, issue_flags); 1068 + cflags = io_put_kbuf(req, ret); 1069 1069 rw->len = 0; /* similarly to above, reset len to 0 */ 1070 1070 1071 1071 if (io_req_post_cqe(req, ret, cflags | IORING_CQE_F_MORE)) { ··· 1362 1362 if (!smp_load_acquire(&req->iopoll_completed)) 1363 1363 break; 1364 1364 nr_events++; 1365 - req->cqe.flags = io_put_kbuf(req, req->cqe.res, 0); 1365 + req->cqe.flags = io_put_kbuf(req, req->cqe.res); 1366 1366 if (req->opcode != IORING_OP_URING_CMD) 1367 1367 io_req_rw_cleanup(req, 0); 1368 1368 }