On Mon, Apr 13, 2020 at 11:29 AM Jens Axboe <axboe@xxxxxxxxx> wrote: > > On 4/13/20 1:19 AM, Xiaoguang Wang wrote: > > Indeed I'm not sure this patch is necessary, robust applications > > should not call io_uring_submit when there are not sqes to submmit. > > But still try to add this check, I have seen some applications which > > call io_uring_submit(), but there are not sqes to submit. > > Hmm, not sure it's worth complicating the submit path for that case. > A high performant application should not call io_uring_submit() if > it didn't queue anything new. Is this a common case you've seen? > My code calls io_uring_submit() even if there are no sqes to submit to avoid spinning if there's nothing to do: ... uint32_t sleep = (gt::user_contexts_waiting() > 0) ? 0 : 1; auto res = io_uring_submit_and_wait(&m_io_uring, sleep); ... -- I doubt, therefore I might be.