提交 697ad1d7 编写于 作者: P Pavel Begunkov 提交者: Xiaoguang Wang

io_uring: simplify io_timeout locking

to #28736503

commit 733f5c95e6fdabd05b8dfc15e04512809c9652c2 upstream

Move spin_lock_irq() earlier to have only 1 call site of it in
io_timeout(). It makes the flow easier.
Signed-off-by: NPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
Signed-off-by: NXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
Acked-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
上级 a1be6c19
...@@ -4767,6 +4767,7 @@ static int io_timeout(struct io_kiocb *req) ...@@ -4767,6 +4767,7 @@ static int io_timeout(struct io_kiocb *req)
u32 seq = req->sequence; u32 seq = req->sequence;
data = &req->io->timeout; data = &req->io->timeout;
spin_lock_irq(&ctx->completion_lock);
/* /*
* sqe->off holds how many events that need to occur for this * sqe->off holds how many events that need to occur for this
...@@ -4775,7 +4776,6 @@ static int io_timeout(struct io_kiocb *req) ...@@ -4775,7 +4776,6 @@ static int io_timeout(struct io_kiocb *req)
*/ */
if (!count) { if (!count) {
req->flags |= REQ_F_TIMEOUT_NOSEQ; req->flags |= REQ_F_TIMEOUT_NOSEQ;
spin_lock_irq(&ctx->completion_lock);
entry = ctx->timeout_list.prev; entry = ctx->timeout_list.prev;
goto add; goto add;
} }
...@@ -4786,7 +4786,6 @@ static int io_timeout(struct io_kiocb *req) ...@@ -4786,7 +4786,6 @@ static int io_timeout(struct io_kiocb *req)
* Insertion sort, ensuring the first entry in the list is always * Insertion sort, ensuring the first entry in the list is always
* the one we need first. * the one we need first.
*/ */
spin_lock_irq(&ctx->completion_lock);
list_for_each_prev(entry, &ctx->timeout_list) { list_for_each_prev(entry, &ctx->timeout_list) {
struct io_kiocb *nxt = list_entry(entry, struct io_kiocb, list); struct io_kiocb *nxt = list_entry(entry, struct io_kiocb, list);
unsigned nxt_seq; unsigned nxt_seq;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册