Re: [PATCH v3] io_uring: don't wait when under-submitting

From: Jens Axboe
Date: Mon Dec 16 2019 - 11:52:03 EST


On 12/16/19 9:47 AM, Pavel Begunkov wrote:
> On 16/12/2019 00:33, Jens Axboe wrote:
>> On 12/15/19 8:48 AM, Pavel Begunkov wrote:
>>> On 15/12/2019 08:42, Jens Axboe wrote:
>>>> On 12/14/19 11:43 AM, Jens Axboe wrote:
>>>>> On 12/14/19 7:53 AM, Pavel Begunkov wrote:
>>>>>> There is no reliable way to submit and wait in a single syscall, as
>>>>>> io_submit_sqes() may under-consume sqes (in case of an early error).
>>>>>> Then it will wait for not-yet-submitted requests, deadlocking the user
>>>>>> in most cases.
>>>>>>
>>>>>> In such cases adjust min_complete, so it won't wait for more than
>>>>>> what have been submitted in the current call to io_uring_enter(). It
>>>>>> may be less than totally in-flight including previous submissions,
>>>>>> but this shouldn't do harm and up to a user.
>>>>>
>>>>> Thanks, applied.
>>>>
>>>> This causes a behavioral change where if you ask to submit 1 but
>>>> there's nothing in the SQ ring, then you would get 0 before. Now
>>>> you get -EAGAIN. This doesn't make a lot of sense, since there's no
>>>> point in retrying as that won't change anything.
>>>>
>>>> Can we please just do something like the one I sent, instead of trying
>>>> to over-complicate it?
>>>>
>>>
>>> Ok, when I get to a compiler.
>>
>> Great, thanks. BTW, I noticed when a regression test failed.
>>
>
> Yeah, I properly tested only the first one. Clearly, not as easy as
> I thought, and there were more to consider.
>
> I sent the next version, but that's odd basically taking your code.
> Probably, it would have been easier for you to just commit it yourself.

Nah, I'll keep you attribution, the hard part is finding/spotting the
issue, not the actual fix. I've applied v4, thanks Pavel!

--
Jens Axboe