diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2020-12-17 03:24:39 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2020-12-17 18:40:52 +0300 |
commit | 89448c47b8452b67c146dc6cad6f737e004c5caf (patch) | |
tree | f527adac664ed71f71c625ec159276411b142b95 /fs/io_uring.c | |
parent | 09e88404f46cc32237f596c66f48a826294e08f2 (diff) | |
download | linux-89448c47b8452b67c146dc6cad6f737e004c5caf.tar.xz |
io_uring: limit {io|sq}poll submit locking scope
We don't need to take uring_lock for SQPOLL|IOPOLL to do
io_cqring_overflow_flush() when cq_overflow_list is empty, remove it
from the hot path.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r-- | fs/io_uring.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index 5c9aa8b5e077..8cf6f22afc5e 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -9154,10 +9154,13 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit, */ ret = 0; if (ctx->flags & IORING_SETUP_SQPOLL) { - io_ring_submit_lock(ctx, (ctx->flags & IORING_SETUP_IOPOLL)); - if (!list_empty_careful(&ctx->cq_overflow_list)) + if (!list_empty_careful(&ctx->cq_overflow_list)) { + bool needs_lock = ctx->flags & IORING_SETUP_IOPOLL; + + io_ring_submit_lock(ctx, needs_lock); io_cqring_overflow_flush(ctx, false, NULL, NULL); - io_ring_submit_unlock(ctx, (ctx->flags & IORING_SETUP_IOPOLL)); + io_ring_submit_unlock(ctx, needs_lock); + } if (flags & IORING_ENTER_SQ_WAKEUP) wake_up(&ctx->sq_data->wait); if (flags & IORING_ENTER_SQ_WAIT) |