Skip to content

Commit df8599e

Browse files
committed
io_uring/napi: cap busy_poll_to 10 msec
Currently there's no cap on the maximum amount of time that napi is allowed to poll if no events are found, which can lead to kernel complaints on a task being stuck as there's no conditional rescheduling done within that loop. Just cap it to 10 msec in total, that's already way above any kind of sane value that will reap any benefits, yet low enough that it's nowhere near being able to trigger preemption complaints. Fixes: 8d0c12a ("io-uring: add napi busy poll support") Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 7deba79 commit df8599e

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

io_uring/napi.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@ static int io_napi_register_napi(struct io_ring_ctx *ctx,
276276
/* clean the napi list for new settings */
277277
io_napi_free(ctx);
278278
WRITE_ONCE(ctx->napi_track_mode, napi->op_param);
279+
/* cap NAPI at 10 msec of spin time */
280+
napi->busy_poll_to = min(10000, napi->busy_poll_to);
279281
WRITE_ONCE(ctx->napi_busy_poll_dt, napi->busy_poll_to * NSEC_PER_USEC);
280282
WRITE_ONCE(ctx->napi_prefer_busy_poll, !!napi->prefer_busy_poll);
281283
return 0;

0 commit comments

Comments
 (0)