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: merge ubuf sendzc callbacks

Splitting io_tx_ubuf_callback_ext from io_tx_ubuf_callback is a pre
mature optimisation that doesn't give us much. Merge the functions into
one and reclaim some simplicity back.

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

authored by

Pavel Begunkov and committed by
Jens Axboe
99863292 bbbef3e9

+8 -18
+8 -18
io_uring/notif.c
··· 30 30 struct io_notif_data *nd = container_of(uarg, struct io_notif_data, uarg); 31 31 struct io_kiocb *notif = cmd_to_io_kiocb(nd); 32 32 33 - if (refcount_dec_and_test(&uarg->refcnt)) 34 - __io_req_task_work_add(notif, IOU_F_TWQ_LAZY_WAKE); 35 - } 36 - 37 - static void io_tx_ubuf_callback_ext(struct sk_buff *skb, struct ubuf_info *uarg, 38 - bool success) 39 - { 40 - struct io_notif_data *nd = container_of(uarg, struct io_notif_data, uarg); 41 - 42 33 if (nd->zc_report) { 43 34 if (success && !nd->zc_used && skb) 44 35 WRITE_ONCE(nd->zc_used, true); 45 36 else if (!success && !nd->zc_copied) 46 37 WRITE_ONCE(nd->zc_copied, true); 47 38 } 48 - io_tx_ubuf_callback(skb, uarg, success); 39 + 40 + if (refcount_dec_and_test(&uarg->refcnt)) 41 + __io_req_task_work_add(notif, IOU_F_TWQ_LAZY_WAKE); 49 42 } 50 43 51 44 void io_notif_set_extended(struct io_kiocb *notif) 52 45 { 53 46 struct io_notif_data *nd = io_notif_to_data(notif); 54 47 55 - if (nd->uarg.callback != io_tx_ubuf_callback_ext) { 56 - nd->account_pages = 0; 57 - nd->zc_report = false; 58 - nd->zc_used = false; 59 - nd->zc_copied = false; 60 - nd->uarg.callback = io_tx_ubuf_callback_ext; 61 - notif->io_task_work.func = io_notif_complete_tw_ext; 62 - } 48 + nd->zc_used = false; 49 + nd->zc_copied = false; 50 + notif->io_task_work.func = io_notif_complete_tw_ext; 63 51 } 64 52 65 53 struct io_kiocb *io_alloc_notif(struct io_ring_ctx *ctx) ··· 67 79 notif->io_task_work.func = io_req_task_complete; 68 80 69 81 nd = io_notif_to_data(notif); 82 + nd->zc_report = false; 83 + nd->account_pages = 0; 70 84 nd->uarg.flags = IO_NOTIF_UBUF_FLAGS; 71 85 nd->uarg.callback = io_tx_ubuf_callback; 72 86 refcount_set(&nd->uarg.refcnt, 1);