Skip to content

Commit 489b800

Browse files
isilenceaxboe
authored andcommitted
io_uring/napi: refactor __io_napi_busy_loop()
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]> Link: https://lore.kernel.org/r/2ad7ede8cc7905328fc62e8c3805fdb11635ae0b.1723039801.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
1 parent a69307a commit 489b800

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

io_uring/napi.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,11 @@ void __io_napi_adjust_timeout(struct io_ring_ctx *ctx, struct io_wait_queue *iow
299299
*/
300300
void __io_napi_busy_loop(struct io_ring_ctx *ctx, struct io_wait_queue *iowq)
301301
{
302-
iowq->napi_prefer_busy_poll = READ_ONCE(ctx->napi_prefer_busy_poll);
302+
if (ctx->flags & IORING_SETUP_SQPOLL)
303+
return;
303304

304-
if (!(ctx->flags & IORING_SETUP_SQPOLL))
305-
io_napi_blocking_busy_loop(ctx, iowq);
305+
iowq->napi_prefer_busy_poll = READ_ONCE(ctx->napi_prefer_busy_poll);
306+
io_napi_blocking_busy_loop(ctx, iowq);
306307
}
307308

308309
/*

0 commit comments

Comments
 (0)