Skip to content

Commit

Permalink
Merge branch 'for_each_cqe' of https://github.com/CPestka/liburing
Browse files Browse the repository at this point in the history
* 'for_each_cqe' of https://github.com/CPestka/liburing:
  liburing: Pull load_acquire out of for loop to amortize cost
  • Loading branch information
axboe committed Sep 29, 2024
2 parents 3ca941c + cb02d22 commit 40df5e6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/include/liburing.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,9 @@ int __io_uring_get_cqe(struct io_uring *ring,
* io_uring_smp_load_acquire() enforces the order of tail \
* and CQE reads. \
*/ \
unsigned __liburing_internal_cached_tail = io_uring_smp_load_acquire((ring)->cq.ktail); \
for (head = *(ring)->cq.khead; \
(cqe = (head != io_uring_smp_load_acquire((ring)->cq.ktail) ? \
(cqe = (head != __liburing_internal_cached_tail ? \
&(ring)->cq.cqes[io_uring_cqe_index(ring, head, (ring)->cq.ring_mask)] : NULL)); \
head++) \

Expand Down

0 comments on commit 40df5e6

Please sign in to comment.