-
The documentation for
But as an application author, I don’t get to control submission boundaries! Even if I have two SQEs free in the ring, and I fill them both and pass 2 as the This is not quite the same as this question. That question was about handling running out of SQEs in the ring, which the application can handle by just not doing that (don’t start a chain if you can’t finish it). This question is about putting an entire chain in the ring, and then the kernel deciding to break up the batch. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 9 replies
-
What I do as an application author is, I have this function: inline void
reserve_sqes( io_uring* ring, unsigned n ) {
auto r = io_uring_sq_space_left( ring );
if ( r < n ) {
io_uring_submit( ring );
}
} . |
Beta Was this translation helpful? Give feedback.
-
Ah, I guess if the only early return reason really is actual total OOM and expected to be nonrecoverable, that would be OK? The way the man page was written, I read it as “don’t stop on errors” (e.g. invalid opcode, invalid parameter, stuff like that); I was considering that the kernel might still decide “for fairness with other applications/avoiding using too much memory/whatever reason I feel like, I only want to take 100 SQEs right now and leave the other ones for later” and that would not be considered an error (
Good to know! That sounds like something that might be worth documenting in the man page. I suppose the alternative is to just implement exactly the same thing in userspace, i.e. just don’t submit any more ops for the affected chain until every preceding op has CQEd. |
Beta Was this translation helpful? Give feedback.
In the unlikely event that a short submission occurs, couldn't you just wait for submitted requests to complete before submitting the rest?