io_uring/napi: ensure napi polling is aborted when work is available
authorJens Axboe <axboe@kernel.dk>
Wed, 14 Feb 2024 19:59:36 +0000 (12:59 -0700)
committerJens Axboe <axboe@kernel.dk>
Wed, 14 Feb 2024 20:01:25 +0000 (13:01 -0700)
commit428f13826855e3eea44bf13cedbf33f382ef8794
treef6d779f7ed0c23be2cf59ff90387b68f204be8c7
parent3fb1764c6b57808ddab7fe7c242fa04c2479ef0a
io_uring/napi: ensure napi polling is aborted when work is available

While testing io_uring NAPI with DEFER_TASKRUN, I ran into slowdowns and
stalls in packet delivery. Turns out that while
io_napi_busy_loop_should_end() aborts appropriately on regular
task_work, it does not abort if we have local task_work pending.

Move io_has_work() into the private io_uring.h header, and gate whether
we should continue polling on that as well. This makes NAPI polling on
send/receive work as designed with IORING_SETUP_DEFER_TASKRUN as well.

Fixes: 8d0c12a80cde ("io-uring: add napi busy poll support")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/io_uring.c
io_uring/io_uring.h
io_uring/napi.c