public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: [email protected]
Cc: Jens Axboe <[email protected]>,
	[email protected], Lewis Baker <[email protected]>
Subject: [PATCH v2 1/4] io_uring/napi: refactor __io_napi_busy_loop()
Date: Wed,  7 Aug 2024 15:18:11 +0100	[thread overview]
Message-ID: <2ad7ede8cc7905328fc62e8c3805fdb11635ae0b.1723039801.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>

we don't need to set ->napi_prefer_busy_poll if we're not going to poll,
do the checks first and all polling preparation after.

Signed-off-by: Pavel Begunkov <[email protected]>
---
 io_uring/napi.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/io_uring/napi.c b/io_uring/napi.c
index 4fd6bb331e1e..a670f49e30ef 100644
--- a/io_uring/napi.c
+++ b/io_uring/napi.c
@@ -301,10 +301,11 @@ void __io_napi_adjust_timeout(struct io_ring_ctx *ctx, struct io_wait_queue *iow
  */
 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)
+		return;
 
-	if (!(ctx->flags & IORING_SETUP_SQPOLL) && ctx->napi_enabled)
-		io_napi_blocking_busy_loop(ctx, iowq);
+	iowq->napi_prefer_busy_poll = READ_ONCE(ctx->napi_prefer_busy_poll);
+	io_napi_blocking_busy_loop(ctx, iowq);
 }
 
 /*
-- 
2.45.2


  reply	other threads:[~2024-08-07 14:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-07 14:18 [PATCH v2 0/4] clodkid and abs mode CQ wait timeouts Pavel Begunkov
2024-08-07 14:18 ` Pavel Begunkov [this message]
2024-08-07 14:18 ` [PATCH v2 2/4] io_uring/napi: postpone napi timeout adjustment Pavel Begunkov
2024-08-07 14:18 ` [PATCH v2 3/4] io_uring: add absolute mode wait timeouts Pavel Begunkov
2024-08-07 14:18 ` [PATCH v2 4/4] io_uring: user registered clockid for " Pavel Begunkov
2024-08-12 18:13 ` [PATCH v2 0/4] clodkid and abs mode CQ " Jens Axboe
2024-08-12 18:30   ` Jens Axboe
2024-08-13  0:50     ` Pavel Begunkov
2024-08-13  0:59       ` Jens Axboe
2024-08-13  1:32         ` Pavel Begunkov
2024-08-13  2:09           ` Jens Axboe
2024-08-13  2:38             ` Pavel Begunkov
2024-08-13  3:28               ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2ad7ede8cc7905328fc62e8c3805fdb11635ae0b.1723039801.git.asml.silence@gmail.com \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox