Commit 9dedd563 authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe

io_uring: partially inline io_iopoll_getevents()

io_iopoll_reap_events() doesn't care about returned valued of
io_iopoll_getevents() and does the same checks for list emptiness
and need_resched(). Just use io_do_iopoll().

io_sq_thread() doesn't check return value as well. It also passes min=0,
so there never be the second iteration inside io_poll_getevents().
Inline it there too.
Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 3fcee5a6
...@@ -2064,7 +2064,7 @@ static void io_iopoll_reap_events(struct io_ring_ctx *ctx) ...@@ -2064,7 +2064,7 @@ static void io_iopoll_reap_events(struct io_ring_ctx *ctx)
while (!list_empty(&ctx->poll_list)) { while (!list_empty(&ctx->poll_list)) {
unsigned int nr_events = 0; unsigned int nr_events = 0;
io_iopoll_getevents(ctx, &nr_events, 1); io_do_iopoll(ctx, &nr_events, 1);
/* /*
* Ensure we allow local-to-the-cpu processing to take place, * Ensure we allow local-to-the-cpu processing to take place,
...@@ -6318,8 +6318,8 @@ static int io_sq_thread(void *data) ...@@ -6318,8 +6318,8 @@ static int io_sq_thread(void *data)
unsigned nr_events = 0; unsigned nr_events = 0;
mutex_lock(&ctx->uring_lock); mutex_lock(&ctx->uring_lock);
if (!list_empty(&ctx->poll_list)) if (!list_empty(&ctx->poll_list) && !need_resched())
io_iopoll_getevents(ctx, &nr_events, 0); io_do_iopoll(ctx, &nr_events, 0);
else else
timeout = jiffies + ctx->sq_thread_idle; timeout = jiffies + ctx->sq_thread_idle;
mutex_unlock(&ctx->uring_lock); mutex_unlock(&ctx->uring_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment