Commit 9affd664 authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe
Browse files

io_uring: don't flush CQEs deep down the stack



io_submit_flush_completions() is called down the stack in the _state
version of io_req_complete(), that's ok because is only called by
io_uring opcode handler functions directly. Move it up to
__io_queue_sqe() as preparation.

Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent a38d68db
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -1941,8 +1941,7 @@ static void io_req_complete_state(struct io_kiocb *req, long res,
	req->result = res;
	req->compl.cflags = cflags;
	list_add_tail(&req->compl.list, &cs->list);
	if (++cs->nr >= 32)
		io_submit_flush_completions(cs);
	cs->nr++;
}

static inline void __io_req_complete(struct io_kiocb *req, long res,
@@ -6577,7 +6576,15 @@ static void __io_queue_sqe(struct io_kiocb *req, struct io_comp_state *cs)
			io_queue_linked_timeout(linked_timeout);
	} else if (likely(!ret)) {
		/* drop submission reference */
		if (cs) {
			io_put_req(req);
			if (cs->nr >= 32)
				io_submit_flush_completions(cs);
			req = NULL;
		} else {
			req = io_put_req_find_next(req);
		}

		if (linked_timeout)
			io_queue_linked_timeout(linked_timeout);