* Returns true if we're not using SQ thread (thus nobody submits but us) * or if IORING_SQ_NEED_WAKEUP is set, so submit thread must be explicitly * awakened. For the latter case, we set the thread wakeup flag. * If no SQEs are ready for submission, returns false. */
| 15 | * If no SQEs are ready for submission, returns false. |
| 16 | */ |
| 17 | static inline bool sq_ring_needs_enter(struct io_uring *ring, |
| 18 | unsigned submit, |
| 19 | unsigned *flags) |
| 20 | { |
| 21 | if (!submit) |
| 22 | return false; |
| 23 | |
| 24 | if (!(ring->flags & IORING_SETUP_SQPOLL)) |
| 25 | return true; |
| 26 | |
| 27 | /* |
| 28 | * Ensure the kernel can see the store to the SQ tail before we read |
| 29 | * the flags. |
| 30 | */ |
| 31 | io_uring_smp_mb(); |
| 32 | |
| 33 | if (uring_unlikely(IO_URING_READ_ONCE(*ring->sq.kflags) & |
| 34 | IORING_SQ_NEED_WAKEUP)) { |
| 35 | *flags |= IORING_ENTER_SQ_WAKEUP; |
| 36 | return true; |
| 37 | } |
| 38 | |
| 39 | return false; |
| 40 | } |
| 41 | |
| 42 | static inline bool cq_ring_needs_flush(struct io_uring *ring) |
| 43 | { |
no outgoing calls
no test coverage detected