Skip to content

Commit 84f2eec

Browse files
Olivier Langloisaxboe
authored andcommitted
io_uring/napi: check napi_enabled in io_napi_add() before proceeding
doing so avoids the overhead of adding napi ids to all the rings that do not enable napi. if no id is added to napi_list because napi is disabled, __io_napi_busy_loop() will not be called. Signed-off-by: Olivier Langlois <[email protected]> Fixes: b4ccc4d ("io_uring/napi: enable even with a timeout of 0") Link: https://lore.kernel.org/r/bd989ccef5fda14f5fd9888faf4fefcf66bd0369.1723400131.git.olivier@trillion01.com Signed-off-by: Jens Axboe <[email protected]>
1 parent 8fe8ac2 commit 84f2eec

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

io_uring/napi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ void __io_napi_busy_loop(struct io_ring_ctx *ctx, struct io_wait_queue *iowq)
302302
{
303303
iowq->napi_prefer_busy_poll = READ_ONCE(ctx->napi_prefer_busy_poll);
304304

305-
if (!(ctx->flags & IORING_SETUP_SQPOLL) && ctx->napi_enabled)
305+
if (!(ctx->flags & IORING_SETUP_SQPOLL))
306306
io_napi_blocking_busy_loop(ctx, iowq);
307307
}
308308

io_uring/napi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static inline void io_napi_add(struct io_kiocb *req)
5555
struct io_ring_ctx *ctx = req->ctx;
5656
struct socket *sock;
5757

58-
if (!READ_ONCE(ctx->napi_busy_poll_dt))
58+
if (!READ_ONCE(ctx->napi_enabled))
5959
return;
6060

6161
sock = sock_from_file(req->file);

0 commit comments

Comments
 (0)