We need to set tctx->sqpoll only when we add a new entry into ->xa, so move it from the hot path. Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx> --- fs/io_uring.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 9175ab937e34..869e564ce713 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -8709,18 +8709,19 @@ static int io_uring_add_task_file(struct io_ring_ctx *ctx, struct file *file) fput(file); return ret; } + + /* + * This is race safe in that the task itself is doing + * this, hence it cannot be going through the exit/cancel + * paths at the same time. This cannot be modified while + * exit/cancel is running. + */ + if (ctx->flags & IORING_SETUP_SQPOLL) + tctx->sqpoll = true; } tctx->last = file; } - /* - * This is race safe in that the task itself is doing this, hence it - * cannot be going through the exit/cancel paths at the same time. - * This cannot be modified while exit/cancel is running. - */ - if (!tctx->sqpoll && (ctx->flags & IORING_SETUP_SQPOLL)) - tctx->sqpoll = true; - return 0; } -- 2.24.0