From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>,
[email protected], [email protected]
Subject: [PATCH 3/5] io_uring: batch free in batched completion
Date: Tue, 14 Jul 2020 02:41:54 +0300 [thread overview]
Message-ID: <2c4f704c045d000a26a526eaaac1af8a68216b90.1594683622.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>
io_submit_flush_completions() already does batching, hence also bundle
freeing reusing batch_free from iopoll.
Signed-off-by: Pavel Begunkov <[email protected]>
---
fs/io_uring.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 3277a06e2fb6..6f767781351f 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1795,6 +1795,7 @@ static void io_req_free_batch(struct req_batch *rb, struct io_kiocb *req)
static void io_submit_flush_completions(struct io_comp_state *cs)
{
+ struct req_batch rb;
struct io_kiocb *req;
struct io_ring_ctx *ctx = cs->ctx;
int i, nr = cs->nr;
@@ -1808,8 +1809,13 @@ static void io_submit_flush_completions(struct io_comp_state *cs)
spin_unlock_irq(&ctx->completion_lock);
io_cqring_ev_posted(ctx);
- for (i = 0; i < nr; ++i)
- io_put_req(cs->reqs[i]);
+ rb.to_free = 0;
+ for (i = 0; i < nr; ++i) {
+ req = cs->reqs[i];
+ if (refcount_dec_and_test(&req->refs))
+ io_req_free_batch(&rb, req);
+ }
+ io_req_free_batch_finish(ctx, &rb);
cs->nr = 0;
}
--
2.24.0
next prev parent reply other threads:[~2020-07-13 23:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-13 23:41 [PATCH 0/5] batch completion + freeing improvements Pavel Begunkov
2020-07-13 23:41 ` [PATCH 1/5] io_uring: move io_req_complete() definition Pavel Begunkov
2020-07-13 23:41 ` [PATCH 2/5] io_uring: replace list with array for compl batch Pavel Begunkov
2020-07-13 23:41 ` Pavel Begunkov [this message]
2020-07-13 23:41 ` [PATCH 4/5] tasks: add put_task_struct_many() Pavel Begunkov
2020-07-13 23:41 ` [PATCH 5/5] io_uring: batch put_task_struct() Pavel Begunkov
2020-07-14 1:08 ` [PATCH 0/5] batch completion + freeing improvements Jens Axboe
2020-07-14 7:15 ` Pavel Begunkov
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=2c4f704c045d000a26a526eaaac1af8a68216b90.1594683622.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