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/net: get rid of io_notif_complete_tw_ext

io_notif_complete_tw_ext() can be removed and combined with
io_notif_complete_tw to make it simpler without sacrificing
anything.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/025a124a5e20e2474a57e2f04f16c422eb83063c.1712534031.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Pavel Begunkov and committed by
Jens Axboe
6b7f864b 99863292

+14 -20
+5 -5
io_uring/net.c
··· 1018 1018 if (zc->flags & ~IO_ZC_FLAGS_VALID) 1019 1019 return -EINVAL; 1020 1020 if (zc->flags & IORING_SEND_ZC_REPORT_USAGE) { 1021 - io_notif_set_extended(notif); 1022 - io_notif_to_data(notif)->zc_report = true; 1021 + struct io_notif_data *nd = io_notif_to_data(notif); 1022 + 1023 + nd->zc_report = true; 1024 + nd->zc_used = false; 1025 + nd->zc_copied = false; 1023 1026 } 1024 1027 } 1025 1028 ··· 1131 1128 return ret; 1132 1129 kmsg->msg.sg_from_iter = io_sg_from_iter; 1133 1130 } else { 1134 - io_notif_set_extended(sr->notif); 1135 1131 ret = import_ubuf(ITER_SOURCE, sr->buf, sr->len, &kmsg->msg.msg_iter); 1136 1132 if (unlikely(ret)) 1137 1133 return ret; ··· 1218 1216 struct socket *sock; 1219 1217 unsigned flags; 1220 1218 int ret, min_ret = 0; 1221 - 1222 - io_notif_set_extended(sr->notif); 1223 1219 1224 1220 sock = sock_from_file(req->file); 1225 1221 if (unlikely(!sock))
+5 -13
io_uring/notif.c
··· 9 9 #include "notif.h" 10 10 #include "rsrc.h" 11 11 12 - static void io_notif_complete_tw_ext(struct io_kiocb *notif, struct io_tw_state *ts) 12 + void io_notif_tw_complete(struct io_kiocb *notif, struct io_tw_state *ts) 13 13 { 14 14 struct io_notif_data *nd = io_notif_to_data(notif); 15 15 struct io_ring_ctx *ctx = notif->ctx; 16 16 17 - if (nd->zc_report && (nd->zc_copied || !nd->zc_used)) 17 + if (unlikely(nd->zc_report) && (nd->zc_copied || !nd->zc_used)) 18 18 notif->cqe.res |= IORING_NOTIF_USAGE_ZC_COPIED; 19 19 20 20 if (nd->account_pages && ctx->user) { ··· 37 37 WRITE_ONCE(nd->zc_copied, true); 38 38 } 39 39 40 - if (refcount_dec_and_test(&uarg->refcnt)) 40 + if (refcount_dec_and_test(&uarg->refcnt)) { 41 + notif->io_task_work.func = io_notif_tw_complete; 41 42 __io_req_task_work_add(notif, IOU_F_TWQ_LAZY_WAKE); 42 - } 43 - 44 - void io_notif_set_extended(struct io_kiocb *notif) 45 - { 46 - struct io_notif_data *nd = io_notif_to_data(notif); 47 - 48 - nd->zc_used = false; 49 - nd->zc_copied = false; 50 - notif->io_task_work.func = io_notif_complete_tw_ext; 43 + } 51 44 } 52 45 53 46 struct io_kiocb *io_alloc_notif(struct io_ring_ctx *ctx) ··· 57 64 notif->task = current; 58 65 io_get_task_refs(1); 59 66 notif->rsrc_node = NULL; 60 - notif->io_task_work.func = io_req_task_complete; 61 67 62 68 nd = io_notif_to_data(notif); 63 69 nd->zc_report = false;
+4 -2
io_uring/notif.h
··· 20 20 }; 21 21 22 22 struct io_kiocb *io_alloc_notif(struct io_ring_ctx *ctx); 23 - void io_notif_set_extended(struct io_kiocb *notif); 23 + void io_notif_tw_complete(struct io_kiocb *notif, struct io_tw_state *ts); 24 24 25 25 static inline struct io_notif_data *io_notif_to_data(struct io_kiocb *notif) 26 26 { ··· 33 33 struct io_notif_data *nd = io_notif_to_data(notif); 34 34 35 35 /* drop slot's master ref */ 36 - if (refcount_dec_and_test(&nd->uarg.refcnt)) 36 + if (refcount_dec_and_test(&nd->uarg.refcnt)) { 37 + notif->io_task_work.func = io_notif_tw_complete; 37 38 __io_req_task_work_add(notif, IOU_F_TWQ_LAZY_WAKE); 39 + } 38 40 } 39 41 40 42 static inline int io_notif_account_mem(struct io_kiocb *notif, unsigned len)