diff options
| author | Olivier Langlois <olivier@trillion01.com> | 2024-08-11 14:07:11 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-08-29 17:35:52 +0200 |
| commit | 00df458f814364f9e7163a2738ce4fcb3c743d22 (patch) | |
| tree | a7db0efe7c1c38f02b8fc96eb66d016409ad0418 /io_uring | |
| parent | b8a04f39453ac7ffceb9081205922cb8f5e1a805 (diff) | |
| download | linux-00df458f814364f9e7163a2738ce4fcb3c743d22.tar.gz linux-00df458f814364f9e7163a2738ce4fcb3c743d22.tar.bz2 linux-00df458f814364f9e7163a2738ce4fcb3c743d22.zip | |
io_uring/napi: check napi_enabled in io_napi_add() before proceeding
[ Upstream commit 84f2eecf95018386c145ada19bb45b03bdb80d9e ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'io_uring')
| -rw-r--r-- | io_uring/napi.c | 2 | ||||
| -rw-r--r-- | io_uring/napi.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/io_uring/napi.c b/io_uring/napi.c index 6bdb267e9c33..ab5d68d4440c 100644 --- a/io_uring/napi.c +++ b/io_uring/napi.c @@ -311,7 +311,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); } diff --git a/io_uring/napi.h b/io_uring/napi.h index babbee36cd3e..341d010cf66b 100644 --- a/io_uring/napi.h +++ b/io_uring/napi.h @@ -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); |
