Commit 60053be8 authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe
Browse files

io_uring: remove extra ifs around io_commit_cqring



Now io_commit_cqring() is simple and it tolerates well being called
without a new CQE filled, so kill a bunch of not needed anymore
guards.

Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/36aed692dff402bba00a444a63a9cd2e97a340ea.1647897811.git.asml.silence@gmail.com


[axboe: fold in followup fix]
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 68ca8fc0
Loading
Loading
Loading
Loading
+14 −11
Original line number Diff line number Diff line
@@ -1920,7 +1920,6 @@ static bool __io_cqring_overflow_flush(struct io_ring_ctx *ctx, bool force)
			   ctx->rings->sq_flags & ~IORING_SQ_CQ_OVERFLOW);
	}

	if (posted)
	io_commit_cqring(ctx);
	spin_unlock(&ctx->completion_lock);
	if (posted)
@@ -2361,7 +2360,6 @@ static void __io_req_find_next_prep(struct io_kiocb *req)

	spin_lock(&ctx->completion_lock);
	posted = io_disarm_next(req);
	if (posted)
	io_commit_cqring(ctx);
	spin_unlock(&ctx->completion_lock);
	if (posted)
@@ -10128,7 +10126,6 @@ static __cold bool io_kill_timeouts(struct io_ring_ctx *ctx,
		}
	}
	spin_unlock_irq(&ctx->timeout_lock);
	if (canceled != 0)
	io_commit_cqring(ctx);
	spin_unlock(&ctx->completion_lock);
	if (canceled != 0)
@@ -10149,11 +10146,13 @@ static __cold void io_ring_ctx_wait_and_kill(struct io_ring_ctx *ctx)
		io_unregister_personality(ctx, index);
	mutex_unlock(&ctx->uring_lock);

	/* failed during ring init, it couldn't have issued any requests */
	if (ctx->rings) {
		io_kill_timeouts(ctx, NULL, true);
		io_poll_remove_all(ctx, NULL, true);

		/* if we failed setting up the ctx, we might not have any rings */
		io_iopoll_try_reap_events(ctx);
	}

	INIT_WORK(&ctx->exit_work, io_ring_exit_work);
	/*
@@ -10245,6 +10244,10 @@ static __cold void io_uring_try_cancel_requests(struct io_ring_ctx *ctx,
	struct io_task_cancel cancel = { .task = task, .all = cancel_all, };
	struct io_uring_task *tctx = task ? task->io_uring : NULL;

	/* failed during ring init, it couldn't have issued any requests */
	if (!ctx->rings)
		return;

	while (1) {
		enum io_wq_cancel cret;
		bool ret = false;