]> www.infradead.org Git - users/willy/xarray.git/commitdiff
io_uring/napi: check napi_enabled in io_napi_add() before proceeding
authorOlivier Langlois <olivier@trillion01.com>
Sun, 11 Aug 2024 18:07:11 +0000 (14:07 -0400)
committerJens Axboe <axboe@kernel.dk>
Mon, 12 Aug 2024 18:09:03 +0000 (12:09 -0600)
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 <olivier@trillion01.com>
Fixes: b4ccc4dd1330 ("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 <axboe@kernel.dk>
io_uring/napi.c
io_uring/napi.h

index a3dc3762008fa5074b9110bfe98ee3cb2dedd7b9..73c4159e8405b32810dafe2cb82d5654b5e64bfb 100644 (file)
@@ -302,7 +302,7 @@ void __io_napi_busy_loop(struct io_ring_ctx *ctx, struct io_wait_queue *iowq)
 {
        iowq->napi_prefer_busy_poll = READ_ONCE(ctx->napi_prefer_busy_poll);
 
-       if (!(ctx->flags & IORING_SETUP_SQPOLL) && ctx->napi_enabled)
+       if (!(ctx->flags & IORING_SETUP_SQPOLL))
                io_napi_blocking_busy_loop(ctx, iowq);
 }
 
index 88f1c21d5548ffd16f4975f91f9821fd01399f49..27b88c3eb42894eb5171592b03dd450471c7267d 100644 (file)
@@ -55,7 +55,7 @@ static inline void io_napi_add(struct io_kiocb *req)
        struct io_ring_ctx *ctx = req->ctx;
        struct socket *sock;
 
-       if (!READ_ONCE(ctx->napi_busy_poll_dt))
+       if (!READ_ONCE(ctx->napi_enabled))
                return;
 
        sock = sock_from_file(req->file);