public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: [email protected]
Cc: Jens Axboe <[email protected]>,
	[email protected], Dylan Yudaken <[email protected]>
Subject: [PATCH 5/6] io_uring: add fast path for io_run_local_work()
Date: Thu,  8 Sep 2022 16:56:56 +0100	[thread overview]
Message-ID: <f6a885f372bad2d77d9cd87341b0a86a4000c0ff.1662652536.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>

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 <[email protected]>
---
 io_uring/io_uring.c | 3 +++
 1 file changed, 3 insertions(+)

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)
-- 
2.37.2


  parent reply	other threads:[~2022-09-08 15:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-08 15:56 [PATCH for-next 0/6] defer tw fixes and other cleanups Pavel Begunkov
2022-09-08 15:56 ` [PATCH 1/6] io_uring: further limit non-owner defer-tw cq waiting Pavel Begunkov
2022-09-08 16:39   ` Dylan Yudaken
2022-09-08 15:56 ` [PATCH 2/6] io_uring: disallow defer-tw run w/ no submitters Pavel Begunkov
2022-09-08 16:43   ` Dylan Yudaken
2022-09-08 15:56 ` [PATCH 3/6] io_uring/iopoll: fix unexpected returns Pavel Begunkov
2022-09-08 16:43   ` Dylan Yudaken
2022-09-08 15:56 ` [PATCH 4/6] io_uring/iopoll: unify tw breaking logic Pavel Begunkov
2022-09-08 15:56 ` Pavel Begunkov [this message]
2022-09-08 16:44   ` [PATCH 5/6] io_uring: add fast path for io_run_local_work() Dylan Yudaken
2022-09-08 15:56 ` [PATCH 6/6] io_uring: remove unused return from io_disarm_next Pavel Begunkov
2022-09-08 21:23 ` [PATCH for-next 0/6] defer tw fixes and other cleanups Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f6a885f372bad2d77d9cd87341b0a86a4000c0ff.1662652536.git.asml.silence@gmail.com \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox