Linux io-uring development
 help / color / mirror / Atom feed
* [PATCH] io_uring: use local ctx consistently
@ 2026-04-01  2:21 Yang Xiuwei
  2026-04-01 13:08 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Xiuwei @ 2026-04-01  2:21 UTC (permalink / raw)
  To: Jens Axboe; +Cc: io-uring, Yang Xiuwei

Use the struct io_ring_ctx *ctx already held in io_buffer_select(),
io_send_zc_prep(), and io_timeout_fn() for submit lock/unlock,
compat checks, and cq_timeouts accounting, instead of repeating
req->ctx.

No functional change.

Signed-off-by: Yang Xiuwei <yangxiuwei@kylinos.cn>
---
 io_uring/kbuf.c    | 4 ++--
 io_uring/net.c     | 2 +-
 io_uring/timeout.c | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/io_uring/kbuf.c b/io_uring/kbuf.c
index 5257b3aad395..8da2ff798170 100644
--- a/io_uring/kbuf.c
+++ b/io_uring/kbuf.c
@@ -230,7 +230,7 @@ struct io_br_sel io_buffer_select(struct io_kiocb *req, size_t *len,
 	struct io_br_sel sel = { };
 	struct io_buffer_list *bl;
 
-	io_ring_submit_lock(req->ctx, issue_flags);
+	io_ring_submit_lock(ctx, issue_flags);
 
 	bl = io_buffer_get_list(ctx, buf_group);
 	if (likely(bl)) {
@@ -239,7 +239,7 @@ struct io_br_sel io_buffer_select(struct io_kiocb *req, size_t *len,
 		else
 			sel.addr = io_provided_buffer_select(req, len, bl);
 	}
-	io_ring_submit_unlock(req->ctx, issue_flags);
+	io_ring_submit_unlock(ctx, issue_flags);
 	return sel;
 }
 
diff --git a/io_uring/net.c b/io_uring/net.c
index d27adbe3f20b..338832488483 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -1366,7 +1366,7 @@ int io_send_zc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
 	if (zc->msg_flags & MSG_DONTWAIT)
 		req->flags |= REQ_F_NOWAIT;
 
-	if (io_is_compat(req->ctx))
+	if (io_is_compat(ctx))
 		zc->msg_flags |= MSG_CMSG_COMPAT;
 
 	iomsg = io_msg_alloc_async(req);
diff --git a/io_uring/timeout.c b/io_uring/timeout.c
index cb61d4862fc6..798d88940d14 100644
--- a/io_uring/timeout.c
+++ b/io_uring/timeout.c
@@ -265,8 +265,8 @@ static enum hrtimer_restart io_timeout_fn(struct hrtimer *timer)
 
 	raw_spin_lock_irqsave(&ctx->timeout_lock, flags);
 	list_del_init(&timeout->list);
-	atomic_set(&req->ctx->cq_timeouts,
-		atomic_read(&req->ctx->cq_timeouts) + 1);
+	atomic_set(&ctx->cq_timeouts,
+		atomic_read(&ctx->cq_timeouts) + 1);
 	raw_spin_unlock_irqrestore(&ctx->timeout_lock, flags);
 
 	if (!(data->flags & IORING_TIMEOUT_ETIME_SUCCESS))
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] io_uring: use local ctx consistently
  2026-04-01  2:21 [PATCH] io_uring: use local ctx consistently Yang Xiuwei
@ 2026-04-01 13:08 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2026-04-01 13:08 UTC (permalink / raw)
  To: Yang Xiuwei; +Cc: io-uring

On 3/31/26 8:21 PM, Yang Xiuwei wrote:
> Use the struct io_ring_ctx *ctx already held in io_buffer_select(),
> io_send_zc_prep(), and io_timeout_fn() for submit lock/unlock,
> compat checks, and cq_timeouts accounting, instead of repeating
> req->ctx.
> 
> No functional change.

Please check for-7.1/io_uring first, most/all of these are already
done.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-04-01 13:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-01  2:21 [PATCH] io_uring: use local ctx consistently Yang Xiuwei
2026-04-01 13:08 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox