Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

io_uring: only call io_should_terminate_tw() once for ctx

io_fallback_req_func() calls io_should_terminate_tw() on each req's ctx.
But since the reqs all come from the ctx's fallback_llist, req->ctx will
be ctx for all of the reqs. Therefore, compute ts.cancel as
io_should_terminate_tw(ctx) just once, outside the loop.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Caleb Sander Mateos and committed by
Jens Axboe
4531d165 8cd5a59e

+2 -3
+2 -3
io_uring/io_uring.c
··· 289 289 290 290 percpu_ref_get(&ctx->refs); 291 291 mutex_lock(&ctx->uring_lock); 292 - llist_for_each_entry_safe(req, tmp, node, io_task_work.node) { 293 - ts.cancel = io_should_terminate_tw(req->ctx); 292 + ts.cancel = io_should_terminate_tw(ctx); 293 + llist_for_each_entry_safe(req, tmp, node, io_task_work.node) 294 294 req->io_task_work.func(req, ts); 295 - } 296 295 io_submit_flush_completions(ctx); 297 296 mutex_unlock(&ctx->uring_lock); 298 297 percpu_ref_put(&ctx->refs);