public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] io_uring/napi: check napi_enabled in io_napi_add() before proceeding
@ 2024-08-11 18:07 Olivier Langlois
  2024-08-12 18:11 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Olivier Langlois @ 2024-08-11 18:07 UTC (permalink / raw)
  To: Jens Axboe, Pavel Begunkov, io-uring

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: b4ccc4dd1330 ("io_uring/napi: enable even with a timeout of 0")
---
 io_uring/napi.c | 2 +-
 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 a3dc3762008f..73c4159e8405 100644
--- a/io_uring/napi.c
+++ b/io_uring/napi.c
@@ -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);
 }
 
diff --git a/io_uring/napi.h b/io_uring/napi.h
index 88f1c21d5548..27b88c3eb428 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);
-- 
2.46.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] io_uring/napi: check napi_enabled in io_napi_add() before proceeding
  2024-08-11 18:07 [PATCH] io_uring/napi: check napi_enabled in io_napi_add() before proceeding Olivier Langlois
@ 2024-08-12 18:11 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2024-08-12 18:11 UTC (permalink / raw)
  To: Pavel Begunkov, io-uring, Olivier Langlois


On Sun, 11 Aug 2024 14:07:11 -0400, Olivier Langlois wrote:
> 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.
> 
> 
> [...]

Applied, thanks!

[1/1] io_uring/napi: check napi_enabled in io_napi_add() before proceeding
      commit: 84f2eecf95018386c145ada19bb45b03bdb80d9e

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-08-12 18:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-11 18:07 [PATCH] io_uring/napi: check napi_enabled in io_napi_add() before proceeding Olivier Langlois
2024-08-12 18:11 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox