io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] small optimisations
@ 2021-09-01 23:38 Pavel Begunkov
  2021-09-01 23:38 ` [PATCH 1/2] io_uring: don't disable kiocb_done() CQE batching Pavel Begunkov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Pavel Begunkov @ 2021-09-01 23:38 UTC (permalink / raw)
  To: Jens Axboe, io-uring

I think it'd better to have at least the first patch in 5.15

Pavel Begunkov (2):
  io_uring: don't disable kiocb_done() CQE batching
  io_uring: prolong tctx_task_work() with flushing

 fs/io_uring.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

-- 
2.33.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] io_uring: don't disable kiocb_done() CQE batching
  2021-09-01 23:38 [PATCH 0/2] small optimisations Pavel Begunkov
@ 2021-09-01 23:38 ` Pavel Begunkov
  2021-09-01 23:38 ` [PATCH 2/2] io_uring: prolong tctx_task_work() with flushing Pavel Begunkov
  2021-09-02  2:41 ` [PATCH 0/2] small optimisations Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Pavel Begunkov @ 2021-09-01 23:38 UTC (permalink / raw)
  To: Jens Axboe, io-uring

Not passing issue_flags from kiocb_done() into __io_complete_rw() means
that completion batching for this case is disabled, e.g. for most of
buffered reads.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 fs/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index ef0c7ecc03a0..14b074575eb6 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2656,7 +2656,7 @@ static void __io_complete_rw(struct io_kiocb *req, long res, long res2,
 {
 	if (__io_complete_rw_common(req, res))
 		return;
-	__io_req_complete(req, 0, req->result, io_put_rw_kbuf(req));
+	__io_req_complete(req, issue_flags, req->result, io_put_rw_kbuf(req));
 }
 
 static void io_complete_rw(struct kiocb *kiocb, long res, long res2)
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] io_uring: prolong tctx_task_work() with flushing
  2021-09-01 23:38 [PATCH 0/2] small optimisations Pavel Begunkov
  2021-09-01 23:38 ` [PATCH 1/2] io_uring: don't disable kiocb_done() CQE batching Pavel Begunkov
@ 2021-09-01 23:38 ` Pavel Begunkov
  2021-09-02  2:41 ` [PATCH 0/2] small optimisations Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Pavel Begunkov @ 2021-09-01 23:38 UTC (permalink / raw)
  To: Jens Axboe, io-uring

io_submit_flush_completions() may enqueue linked requests for task_work
execution, so don't leave tctx_task_work() right after the tw list is
exhausted, but try to flush and then retry.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 fs/io_uring.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 14b074575eb6..2bde732a1183 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2102,6 +2102,9 @@ static void tctx_task_work(struct callback_head *cb)
 	while (1) {
 		struct io_wq_work_node *node;
 
+		if (!tctx->task_list.first && locked && ctx->submit_state.compl_nr)
+			io_submit_flush_completions(ctx);
+
 		spin_lock_irq(&tctx->task_lock);
 		node = tctx->task_list.first;
 		INIT_WQ_LIST(&tctx->task_list);
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] small optimisations
  2021-09-01 23:38 [PATCH 0/2] small optimisations Pavel Begunkov
  2021-09-01 23:38 ` [PATCH 1/2] io_uring: don't disable kiocb_done() CQE batching Pavel Begunkov
  2021-09-01 23:38 ` [PATCH 2/2] io_uring: prolong tctx_task_work() with flushing Pavel Begunkov
@ 2021-09-02  2:41 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2021-09-02  2:41 UTC (permalink / raw)
  To: Pavel Begunkov, io-uring

On 9/1/21 5:38 PM, Pavel Begunkov wrote:
> I think it'd better to have at least the first patch in 5.15

Let's just shove both in, they are minor enough.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-09-02  2:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-01 23:38 [PATCH 0/2] small optimisations Pavel Begunkov
2021-09-01 23:38 ` [PATCH 1/2] io_uring: don't disable kiocb_done() CQE batching Pavel Begunkov
2021-09-01 23:38 ` [PATCH 2/2] io_uring: prolong tctx_task_work() with flushing Pavel Begunkov
2021-09-02  2:41 ` [PATCH 0/2] small optimisations Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).