* [PATCH liburing 1/1] src/queue: simplify IORING_SETUP_SQ_REWIND handling
@ 2026-01-29 17:19 Pavel Begunkov
2026-01-29 20:11 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2026-01-29 17:19 UTC (permalink / raw)
To: io-uring; +Cc: asml.silence, axboe
io_uring_load_sq_head() shouldn't need a IORING_SETUP_SQ_REWIND check
as the SQ head should already be zero. Also, add a couple of words about
the tail resetting logic.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
src/include/liburing.h | 3 ---
src/queue.c | 7 +++++++
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/include/liburing.h b/src/include/liburing.h
index b41958ce..8d45d400 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -1684,9 +1684,6 @@ IOURINGINLINE void io_uring_prep_pipe_direct(struct io_uring_sqe *sqe, int *fds,
IOURINGINLINE unsigned io_uring_load_sq_head(const struct io_uring *ring)
LIBURING_NOEXCEPT
{
- if (ring->flags & IORING_SETUP_SQ_REWIND)
- return 0;
-
/*
* Without acquire ordering, we could overwrite a SQE before the kernel
* finished reading it. We don't need the acquire ordering for
diff --git a/src/queue.c b/src/queue.c
index 00995ace..87b4dbbe 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -205,6 +205,13 @@ static unsigned __io_uring_flush_sq(struct io_uring *ring)
struct io_uring_sq *sq = &ring->sq;
unsigned tail = sq->sqe_tail;
+ /*
+ * With IORING_SETUP_SQ_REWIND, the kernel ignores the SQ head / tail
+ * and submits entries from the beginning of the queue. Continue using
+ * the indices as before but reset the tail on submission. With the
+ * head kept to be zero, io_uring_get_sqe() / etc. will work without
+ * any extra changes.
+ */
if (ring->flags & IORING_SETUP_SQ_REWIND) {
sq->sqe_tail = 0;
return tail;
--
2.52.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH liburing 1/1] src/queue: simplify IORING_SETUP_SQ_REWIND handling
2026-01-29 17:19 [PATCH liburing 1/1] src/queue: simplify IORING_SETUP_SQ_REWIND handling Pavel Begunkov
@ 2026-01-29 20:11 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2026-01-29 20:11 UTC (permalink / raw)
To: io-uring, Pavel Begunkov
On Thu, 29 Jan 2026 17:19:31 +0000, Pavel Begunkov wrote:
> io_uring_load_sq_head() shouldn't need a IORING_SETUP_SQ_REWIND check
> as the SQ head should already be zero. Also, add a couple of words about
> the tail resetting logic.
>
>
Applied, thanks!
[1/1] src/queue: simplify IORING_SETUP_SQ_REWIND handling
commit: e63decacd70a6fb00a5a8e85d7af9bf3f29876b5
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-01-29 20:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-29 17:19 [PATCH liburing 1/1] src/queue: simplify IORING_SETUP_SQ_REWIND handling Pavel Begunkov
2026-01-29 20:11 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox