io_uring: optimise hot path restricted checks
Move likely/unlikely from io_check_restriction() to specifically ctx->restricted check, because doesn't do what it supposed to and make the common path take an extra jump. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/22bf70d0a543dfc935d7276bdc73081784e30698.1624739600.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
e5dc480d4e
commit
4cfb25bf88
@ -6506,7 +6506,7 @@ static inline bool io_check_restriction(struct io_ring_ctx *ctx,
|
|||||||
struct io_kiocb *req,
|
struct io_kiocb *req,
|
||||||
unsigned int sqe_flags)
|
unsigned int sqe_flags)
|
||||||
{
|
{
|
||||||
if (!ctx->restricted)
|
if (likely(!ctx->restricted))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!test_bit(req->opcode, ctx->restrictions.sqe_op))
|
if (!test_bit(req->opcode, ctx->restrictions.sqe_op))
|
||||||
@ -6549,7 +6549,7 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (unlikely(req->opcode >= IORING_OP_LAST))
|
if (unlikely(req->opcode >= IORING_OP_LAST))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (unlikely(!io_check_restriction(ctx, req, sqe_flags)))
|
if (!io_check_restriction(ctx, req, sqe_flags))
|
||||||
return -EACCES;
|
return -EACCES;
|
||||||
|
|
||||||
if ((sqe_flags & IOSQE_BUFFER_SELECT) &&
|
if ((sqe_flags & IOSQE_BUFFER_SELECT) &&
|
||||||
|
Loading…
Reference in New Issue
Block a user