Skip to content

Commit

Permalink
man/io_uring_setup.2: improve SQPOLL wakeup example
Browse files Browse the repository at this point in the history
This makes it consistent with how liburing uses it, instead of using
the sledge hammer that is a fully SMP memory barrier on archs that
don't need it.

Reported-by: Joran Dirk Greef <joran@coil.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
axboe committed Sep 7, 2020
1 parent 4b94563 commit 6768ddc
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions man/io_uring_setup.2
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,14 @@ call with the following code sequence:
.in +4n
.EX
/*
* Ensure that the wakeup flag is read after the tail pointer has been
* written.
* Ensure that the wakeup flag is read after the tail pointer
* has been written. It's important to use memory load acquire
* semantics for the flags read, as otherwise the application
* and the kernel might not agree on the consistency of the
* wakeup flag.
*/
smp_mb();
if (*sq_ring->flags & IORING_SQ_NEED_WAKEUP)
unsigned flags = atomic_load_relaxed(sq_ring->flags);
if (flags & IORING_SQ_NEED_WAKEUP)
io_uring_enter(fd, 0, 0, IORING_ENTER_SQ_WAKEUP);
.EE
.in
Expand Down

0 comments on commit 6768ddc

Please sign in to comment.