simple sendzc cleanups
cover simple sendzc cleanups
Simple SENDZC notification cleanups that make sense by themselves split out from the notif stacking series.
Pavel Begunkov (3):
io_uring/notif: refactor io_tx_ubuf_complete() io_uring/notif: remove ctx var from io_notif_tw_complete io_uring/notif: shrink account_pages to u32
io_uring/notif.c | 14 +++++++------- io_uring/notif.h | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-)
Signature · 1 line
2.44.0
PATCH 1/3 io_uring/notif: refactor io_tx_ubuf_complete()
Flip the dec_and_test "if", that makes the function extension easier in the future.
--- io_uring/notif.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
io_uring/notif.c +5 -4
@@ -37,10 +37,11 @@ static void io_tx_ubuf_callback(struct sk_buff *skb, struct ubuf_info *uarg,WRITE_ONCE (nd->zc_copied, true); } -if (refcount_dec_and_test (&uarg->refcnt)) { - notif->io_task_work.func = io_notif_tw_complete; -__io_req_task_work_add (notif,IOU_F_TWQ_LAZY_WAKE ); - } +if (!refcount_dec_and_test (&uarg->refcnt)) +return ; + + notif->io_task_work.func = io_notif_tw_complete; +__io_req_task_work_add (notif,IOU_F_TWQ_LAZY_WAKE ); }struct io_kiocb *io_alloc_notif (struct io_ring_ctx *ctx)
Signature · 1 line
2.44.0
PATCH 2/3 io_uring/notif: remove ctx var from io_notif_tw_complete
In reply to Pavel BegunkovWe don't need ctx in the hottest path, i.e. registered buffers, let's get it only when we need it.
--- io_uring/notif.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
io_uring/notif.c +2 -3
@@ -12,13 +12,12 @@void io_notif_tw_complete (struct io_kiocb *notif,struct io_tw_state *ts) {struct io_notif_data *nd =io_notif_to_data (notif); -struct io_ring_ctx *ctx = notif->ctx;if (unlikely (nd->zc_report) && (nd->zc_copied || !nd->zc_used)) notif->cqe.res |=IORING_NOTIF_USAGE_ZC_COPIED ; -if (nd->account_pages && ctx->user) { -__io_unaccount_mem (ctx->user, nd->account_pages); +if (nd->account_pages && notif->ctx->user) { +__io_unaccount_mem (notif->ctx->user, nd->account_pages); nd->account_pages =0 ; }io_req_task_complete (notif, ts);
Signature · 1 line
2.44.0
PATCH 3/3 io_uring/notif: shrink account_pages to u32
In reply to Pavel Begunkov->account_pages is the number of pages we account against the user derived from unsigned len, it definitely fits into unsigned, which saves some space in struct io_notif_data.
--- io_uring/notif.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
io_uring/notif.h +2 -1
@@ -13,7 +13,8 @@struct io_notif_data {struct file *file;struct ubuf_info uarg; -unsigned long account_pages; + +unsigned account_pages;bool zc_report;bool zc_used;bool zc_copied;
Signature · 1 line
2.44.0
Quoted 9 lines · Pavel Begunkov
Simple SENDZC notification cleanups that make sense by themselves split out from the notif stacking series.
Pavel Begunkov (3):
io_uring/notif: refactorio_tx_ubuf_complete()io_uring/notif: remove ctx var fromio_notif_tw_completeio_uring/notif: shrinkaccount_pagesto u32[...]
Applied, thanks!
[1/3] io_uring/notif: refactor io_tx_ubuf_complete()
commit: 7e58d0af5a587e74f46f55b91a0197f750eba78c
[2/3] io_uring/notif: remove ctx var from io_notif_tw_complete
commit: 2e730d8de45768810df4a6859cd64c5387cf0131
[3/3] io_uring/notif: shrink account_pages to u32
commit: d6e295061f239bee48c9e49313f68042121e21c2Best regards,
Signature · 1 line
Jens Axboe