Re: [PATCH 1/4] io_uring: Always REQ_F_FREE_SQE for allocated sqe

Jens Axboe
2019-11-20T14:25:25Z

On 11/20/19 2:03 AM, Pavel Begunkov wrote:
> On 11/20/2019 1:10 AM, Jens Axboe wrote:
>> and it is tempting as a cleanup, but it
>> also moves it into the fastpath instead of keeping it in the slow
>> link fail path. Any allocated sqe is normally freed when the work
>> is processed, which is generally also a better path to do it in as
>> we know we're not under locks/irq disabled.
>
> Good point with locks/irq, but io_put_req() is usually called out of
> locking. Isn't it? E.g. @completion_lock is taken mainly by *add_cq_event().

It is, yes.

> SQE needs to be freed in any case, and there is only one extra "if",
> what we really should not worry about. There are much heavier parts.
> e.g. excessive atomics/locking, I'll send an RFC for that, if needed.
>
> I find the complexity of much more concern here.

Fair enough, it's not a big addition and it does help clean it up.
I'll apply it.

--
Jens Axboe