Re: [PATCH v2 3/4] io_uring: don't spinlock when not posting CQEs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



在 2021/11/25 上午11:48, Hao Xu 写道:
在 2021/11/10 下午11:49, Pavel Begunkov 写道:
When no of queued for the batch completion requests need to post an CQE,
see IOSQE_CQE_SKIP_SUCCESS, avoid grabbing ->completion_lock and other
commit/post.

Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx>
---
  fs/io_uring.c | 26 +++++++++++++++++---------
  1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 22572cfd6864..0c0ea3bbb50a 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -321,6 +321,7 @@ struct io_submit_state {
      bool            plug_started;
      bool            need_plug;
+    bool            flush_cqes;
      unsigned short        submit_nr;
      struct blk_plug        plug;
  };
@@ -1525,8 +1526,11 @@ static void io_prep_async_link(struct io_kiocb *req)
  static inline void io_req_add_compl_list(struct io_kiocb *req)
  {
+    struct io_ring_ctx *ctx = req->ctx;
      struct io_submit_state *state = &req->ctx->submit_state;
+    if (!(req->flags & REQ_F_CQE_SKIP))
+        ctx->submit_state.flush_cqes = true;
Should we init it to false in submit_state_start()?
Never mind, I saw it in __io_submit_flush_completions() so there is no
problem..



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux