mirror of
https://github.com/openharmony/third_party_liburing.git
synced 2026-07-21 07:05:34 -04:00
!SQPOLL setups don't need acquire/release semantics on SQ ring updates
If we're not using SQPOLL, then we know there will be a system call between the SQ ktail writes or khead reads. This means we don't need acquire/release semantics on the SQ ring, so make them dependent on how the ring was setup. Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
@@ -1240,12 +1240,15 @@ static inline int io_uring_wait_cqe(struct io_uring *ring,
|
||||
static inline struct io_uring_sqe *_io_uring_get_sqe(struct io_uring *ring)
|
||||
{
|
||||
struct io_uring_sq *sq = &ring->sq;
|
||||
unsigned int head = io_uring_smp_load_acquire(sq->khead);
|
||||
unsigned int next = sq->sqe_tail + 1;
|
||||
unsigned int head, next = sq->sqe_tail + 1;
|
||||
int shift = 0;
|
||||
|
||||
if (ring->flags & IORING_SETUP_SQE128)
|
||||
shift = 1;
|
||||
if (!(ring->flags & IORING_SETUP_SQPOLL))
|
||||
head = IO_URING_READ_ONCE(*sq->khead);
|
||||
else
|
||||
head = io_uring_smp_load_acquire(sq->khead);
|
||||
|
||||
if (next - head <= sq->ring_entries) {
|
||||
struct io_uring_sqe *sqe;
|
||||
|
||||
+4
-1
@@ -195,7 +195,10 @@ unsigned __io_uring_flush_sq(struct io_uring *ring)
|
||||
/*
|
||||
* Ensure kernel sees the SQE updates before the tail update.
|
||||
*/
|
||||
io_uring_smp_store_release(sq->ktail, tail);
|
||||
if (!(ring->flags & IORING_SETUP_SQPOLL))
|
||||
io_uring_smp_store_release(sq->ktail, tail);
|
||||
else
|
||||
IO_URING_WRITE_ONCE(*sq->ktail, tail);
|
||||
}
|
||||
/*
|
||||
* This _may_ look problematic, as we're not supposed to be reading
|
||||
|
||||
Reference in New Issue
Block a user