From: Pavel Begunkov Date: Thu, 8 Sep 2022 15:56:56 +0000 (+0100) Subject: io_uring: add fast path for io_run_local_work() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=7924fdfeea814b4f7ff8a16de00951ad93cccf6c;p=linux.git io_uring: add fast path for io_run_local_work() We'll grab uring_lock and call __io_run_local_work() with several atomics inside even if there are no task works. Skip it if ->work_llist is empty. Signed-off-by: Pavel Begunkov Reviewed-by: Dylan Yudaken Link: https://lore.kernel.org/r/f6a885f372bad2d77d9cd87341b0a86a4000c0ff.1662652536.git.asml.silence@gmail.com Signed-off-by: Jens Axboe --- diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 12e8acd300967..433466455a5f6 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -1208,6 +1208,9 @@ int io_run_local_work(struct io_ring_ctx *ctx) bool locked; int ret; + if (llist_empty(&ctx->work_llist)) + return 0; + locked = mutex_trylock(&ctx->uring_lock); ret = __io_run_local_work(ctx, locked); if (locked)