From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH 3/3] io_uring: briefly loose locks while reaping events
Date: Mon, 6 Jul 2020 17:14:13 +0300 [thread overview]
Message-ID: <da2c8de6c06d9ec301b08d023a962fdb85781796.1594044830.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>
It's not nice to hold @uring_lock for too long io_iopoll_reap_events().
For instance, the lock is needed to publish requests to @poll_list, and
that locks out tasks doing that for no good reason. Loose it
occasionally.
Signed-off-by: Pavel Begunkov <[email protected]>
---
fs/io_uring.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 020944a193d0..568e25bcadd6 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2059,11 +2059,14 @@ static void io_iopoll_reap_events(struct io_ring_ctx *ctx)
io_iopoll_getevents(ctx, &nr_events, 1);
+ /* task_work takes the lock to publish a req to @poll_list */
+ mutex_unlock(&ctx->uring_lock);
/*
* Ensure we allow local-to-the-cpu processing to take place,
* in this case we need to ensure that we reap all events.
*/
cond_resched();
+ mutex_lock(&ctx->uring_lock);
}
mutex_unlock(&ctx->uring_lock);
}
--
2.24.0
next prev parent reply other threads:[~2020-07-06 14:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-06 14:14 [PATCH 0/3] iopoll improvements Pavel Begunkov
2020-07-06 14:14 ` [PATCH 1/3] io_uring: don't delay iopoll'ed req completion Pavel Begunkov
2020-07-06 14:14 ` [PATCH 2/3] io_uring: fix stopping iopoll'ing too early Pavel Begunkov
2020-07-06 14:14 ` Pavel Begunkov [this message]
2020-07-06 14:31 ` [PATCH 3/3] io_uring: briefly loose locks while reaping events Jens Axboe
2020-07-06 14:42 ` Pavel Begunkov
2020-07-06 14:45 ` Pavel Begunkov
2020-07-06 14:50 ` 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=da2c8de6c06d9ec301b08d023a962fdb85781796.1594044830.git.asml.silence@gmail.com \
[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