io_uring: mark the need to lock/unlock the ring as unlikely

JIRA: https://issues.redhat.com/browse/RHEL-64867

commit bfe30bfde279529011161a60e5a7ca4be83de422
Author: Jens Axboe <axboe@kernel.dk>
Date:   Sun Jan 28 20:32:52 2024 -0700

    io_uring: mark the need to lock/unlock the ring as unlikely
    
    Any of the fast paths will already have this locked, this helper only
    exists to deal with io-wq invoking request issue where we do not have
    the ctx->uring_lock held already. This means that any common or fast
    path will already have this locked, mark it as such.
    
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
This commit is contained in:
Jeff Moyer 2024-01-28 20:32:52 -07:00
parent 2f24c5fbf1
commit 5d0f19f327
1 changed files with 2 additions and 2 deletions

View File

@ -215,7 +215,7 @@ static inline void io_ring_submit_unlock(struct io_ring_ctx *ctx,
unsigned issue_flags)
{
lockdep_assert_held(&ctx->uring_lock);
if (issue_flags & IO_URING_F_UNLOCKED)
if (unlikely(issue_flags & IO_URING_F_UNLOCKED))
mutex_unlock(&ctx->uring_lock);
}
@ -228,7 +228,7 @@ static inline void io_ring_submit_lock(struct io_ring_ctx *ctx,
* The only exception is when we've detached the request and issue it
* from an async worker thread, grab the lock for that case.
*/
if (issue_flags & IO_URING_F_UNLOCKED)
if (unlikely(issue_flags & IO_URING_F_UNLOCKED))
mutex_lock(&ctx->uring_lock);
lockdep_assert_held(&ctx->uring_lock);
}