Skip to content

Can we delete iovec array after submitting the sqe for readv ? #676

Answered by axboe
yashrs76 asked this question in Q&A
Discussion options

You must be logged in to vote

You may delete the iovec array when the IO has been submitted (rather than wait until it's completed) if the following conditions are true:

  1. You are not setting up the ring with IORING_SETUP_SQPOLL. The iovec must be stable until the IO has been submitted, and you cannot know for sure when that happens when kernel side submission polling is used.
  2. The kernel reports IORING_FEAT_SUBMIT_STABLE in io_uring_params->features when the ring has been setup. This has been the case since kernel 5.5, so not a recent change.

This also means that you don't need to allocate this array from the heap if you're just preparing it for submit, you could have it on the stack as long as it's valid across submi…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by yashrs76
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants