aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2021-06-26 21:40:47 +0100
committerJens Axboe <axboe@kernel.dk>2021-06-30 14:15:40 -0600
commit4cfb25bf8877c947e5ae4875e387babe87e12afa (patch)
tree4ccc1d88717996ae8c74f02c706e9afe6451b809 /fs
parentio_uring: remove not needed PF_EXITING check (diff)
downloadlinux-dev-4cfb25bf8877c947e5ae4875e387babe87e12afa.tar.xz
linux-dev-4cfb25bf8877c947e5ae4875e387babe87e12afa.zip
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/io_uring.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index ce88ad58955a..a5df65f6f9ab 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -6506,7 +6506,7 @@ static inline bool io_check_restriction(struct io_ring_ctx *ctx,
struct io_kiocb *req,
unsigned int sqe_flags)
{
- if (!ctx->restricted)
+ if (likely(!ctx->restricted))
return true;
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;
if (unlikely(req->opcode >= IORING_OP_LAST))
return -EINVAL;
- if (unlikely(!io_check_restriction(ctx, req, sqe_flags)))
+ if (!io_check_restriction(ctx, req, sqe_flags))
return -EACCES;
if ((sqe_flags & IOSQE_BUFFER_SELECT) &&