lkml.org 
[lkml]   [2020]   [Jul]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/5] io_uring: batch free in batched completion
Date
io_submit_flush_completions() already does batching, hence also bundle
freeing reusing batch_free from iopoll.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
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
\
 
 \ /
  Last update: 2020-07-14 01:45    [W:8.550 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site