Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about io_uring_for_each_cqe #867

Closed
MBkkt opened this issue May 28, 2023 · 4 comments
Closed

Question about io_uring_for_each_cqe #867

MBkkt opened this issue May 28, 2023 · 4 comments

Comments

@MBkkt
Copy link

MBkkt commented May 28, 2023

Could you explain why do you do load on every iteration?

https://github.com/axboe/liburing/blob/master/src/include/liburing.h#L295

@axboe
Copy link
Owner

axboe commented May 29, 2023

Reloading it should not be necessary.

@MBkkt
Copy link
Author

MBkkt commented May 29, 2023

@axboe

But behavior with single load and load on every iteration could be different? Because kernel can produce new cqe while it is iterating.
Or I don't understand it right?

@axboe
Copy link
Owner

axboe commented May 29, 2023

That is obviously true, but I would suspect most loops to process CQEs are pretty light (and hence fast) and therefore the likelihood of getting a new entry while looping is pretty small. So while it doesn't hurt to reload the cq tail on every loop, it'd probably be better to avoid it.

@MBkkt
Copy link
Author

MBkkt commented May 29, 2023

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants