diff options
author | Stefan Roesch <shr@devkernel.io> | 2023-06-08 09:38:37 -0700 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2024-02-09 11:54:28 -0700 |
commit | ff183d427da0a733b0dbe11bd7acaf2dcb37b4cc (patch) | |
tree | 608885d59ca17fa553a9a9c9edfae6776b63545b /io_uring/napi.c | |
parent | 8d0c12a80cdeb80d5e0510e96d38fe551ed8e9b5 (diff) |
io-uring: add sqpoll support for napi busy poll
This adds the sqpoll support to the io-uring napi.
Signed-off-by: Stefan Roesch <shr@devkernel.io>
Suggested-by: Olivier Langlois <olivier@trillion01.com>
Link: https://lore.kernel.org/r/20230608163839.2891748-6-shr@devkernel.io
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/napi.c')
-rw-r--r-- | io_uring/napi.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/io_uring/napi.c b/io_uring/napi.c index 1112cc39153c..3e578df36cc5 100644 --- a/io_uring/napi.c +++ b/io_uring/napi.c @@ -252,4 +252,28 @@ void __io_napi_busy_loop(struct io_ring_ctx *ctx, struct io_wait_queue *iowq) io_napi_blocking_busy_loop(ctx, iowq); } +/* + * io_napi_sqpoll_busy_poll() - busy poll loop for sqpoll + * @ctx: pointer to io-uring context structure + * + * Splice of the napi list and execute the napi busy poll loop. + */ +int io_napi_sqpoll_busy_poll(struct io_ring_ctx *ctx) +{ + LIST_HEAD(napi_list); + bool is_stale = false; + + if (!READ_ONCE(ctx->napi_busy_poll_to)) + return 0; + if (list_empty_careful(&ctx->napi_list)) + return 0; + + rcu_read_lock(); + is_stale = __io_napi_do_busy_loop(ctx, NULL); + rcu_read_unlock(); + + io_napi_remove_stale(ctx, is_stale); + return 1; +} + #endif |