Skip to content

Commit f432b76

Browse files
isilenceaxboe
authored andcommitted
io_uring: kill io_cq_unlock()
We're abusing ->completion_lock helpers. io_cq_unlock() neither locking conditionally nor doing CQE flushing, which means that callers must have some side reason of taking the lock and should do it directly. Open code io_cq_unlock() into io_cqring_overflow_kill() and clean it up. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/7dabb36856db2b562e78780480396c52c29b2bf4.1687518903.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 91c7884 commit f432b76

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

io_uring/io_uring.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -644,12 +644,6 @@ static inline void io_cq_lock(struct io_ring_ctx *ctx)
644644
spin_lock(&ctx->completion_lock);
645645
}
646646

647-
static inline void io_cq_unlock(struct io_ring_ctx *ctx)
648-
__releases(ctx->completion_lock)
649-
{
650-
spin_unlock(&ctx->completion_lock);
651-
}
652-
653647
/* keep it inlined for io_submit_flush_completions() */
654648
static inline void __io_cq_unlock_post(struct io_ring_ctx *ctx)
655649
__releases(ctx->completion_lock)
@@ -694,10 +688,10 @@ static void io_cqring_overflow_kill(struct io_ring_ctx *ctx)
694688
struct io_overflow_cqe *ocqe;
695689
LIST_HEAD(list);
696690

697-
io_cq_lock(ctx);
691+
spin_lock(&ctx->completion_lock);
698692
list_splice_init(&ctx->cq_overflow_list, &list);
699693
clear_bit(IO_CHECK_CQ_OVERFLOW_BIT, &ctx->check_cq);
700-
io_cq_unlock(ctx);
694+
spin_unlock(&ctx->completion_lock);
701695

702696
while (!list_empty(&list)) {
703697
ocqe = list_first_entry(&list, struct io_overflow_cqe, list);

0 commit comments

Comments
 (0)