Re: [PATCH] io_uring: initialize task context before running the BPF loop
From: Pavel Begunkov
Date: Tue Sep 22 2026 - 07:58:19 EST
On 9/22/26 07:54, Yao Kai wrote:
...> ---
io_uring/loop.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/io_uring/loop.c b/io_uring/loop.c
index bbbb6ef14e6a..c923cae6dfc7 100644
--- a/io_uring/loop.c
+++ b/io_uring/loop.c
@@ -2,6 +2,7 @@
#include "io_uring.h"
#include "wait.h"
#include "loop.h"
+#include "tctx.h"
static inline int io_loop_nr_cqes(const struct io_ring_ctx *ctx,
const struct iou_loop_params *lp)
@@ -84,6 +85,10 @@ int io_run_loop(struct io_ring_ctx *ctx)
if (!io_allowed_run_tw(ctx))
return -EEXIST;
+ ret = io_uring_add_tctx_node(ctx);
+ if (unlikely(ret))
+ return ret;
+
Looks good in general, but can you move it a couple of lines
up before io_allowed_run_tw()? Thanks
mutex_lock(&ctx->uring_lock);
ret = __io_run_loop(ctx);
mutex_unlock(&ctx->uring_lock);
--
Pavel Begunkov