diff mbox series

[5/6] io_uring: add fast path for io_run_local_work()

Message ID f6a885f372bad2d77d9cd87341b0a86a4000c0ff.1662652536.git.asml.silence@gmail.com (mailing list archive)
State New
Headers show
Series defer tw fixes and other cleanups | expand

Commit Message

Pavel Begunkov Sept. 8, 2022, 3:56 p.m. UTC
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 <asml.silence@gmail.com>
---
 io_uring/io_uring.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Dylan Yudaken Sept. 8, 2022, 4:44 p.m. UTC | #1
On Thu, 2022-09-08 at 16:56 +0100, Pavel Begunkov wrote:
> 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 <asml.silence@gmail.com>
> ---
>  io_uring/io_uring.c | 3 +++
>  1 file changed, 3 insertions(+)

Reviewed-by: Dylan Yudaken <dylany@fb.com>
diff mbox series

Patch

diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 2fb5f1e78fb2..85b795e4dc6a 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)