Skip to content

Commit

Permalink
io_uring: optimise io_req_find_next() fast check
Browse files Browse the repository at this point in the history
gcc 9.2.0 compiles io_req_find_next() as a separate function leaving
the first REQ_F_LINK_HEAD fast check not inlined. Help it by splitting
out the check from the function.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Pavel Begunkov authored and Jens Axboe committed Jun 30, 2020
1 parent 0be0b0e commit 3fa5e0f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions fs/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -1664,12 +1664,9 @@ static void io_fail_links(struct io_kiocb *req)
io_cqring_ev_posted(ctx);
}

static struct io_kiocb *io_req_find_next(struct io_kiocb *req)
static struct io_kiocb *__io_req_find_next(struct io_kiocb *req)
{
if (likely(!(req->flags & REQ_F_LINK_HEAD)))
return NULL;
req->flags &= ~REQ_F_LINK_HEAD;

if (req->flags & REQ_F_LINK_TIMEOUT)
io_kill_linked_timeout(req);

Expand All @@ -1685,6 +1682,13 @@ static struct io_kiocb *io_req_find_next(struct io_kiocb *req)
return NULL;
}

static struct io_kiocb *io_req_find_next(struct io_kiocb *req)
{
if (likely(!(req->flags & REQ_F_LINK_HEAD)))
return NULL;
return __io_req_find_next(req);
}

static void __io_req_task_cancel(struct io_kiocb *req, int error)
{
struct io_ring_ctx *ctx = req->ctx;
Expand Down

0 comments on commit 3fa5e0f

Please sign in to comment.