Re: [PATCH v16 14/26] blk-mq: Restore the zoned write order when requeuing

Bart Van Assche
2024-11-19T21:16:53Z

On 11/18/24 11:52 PM, Damien Le Moal wrote:
> On 11/19/24 09:28, Bart Van Assche wrote:
>> diff --git a/block/blk-mq.c b/block/blk-mq.c
>> index f134d5e1c4a1..1302ccbf2a7d 100644
>> --- a/block/blk-mq.c
>> +++ b/block/blk-mq.c
>> @@ -1564,7 +1564,9 @@ static void blk_mq_requeue_work(struct work_struct *work)
>> * already. Insert it into the hctx dispatch list to avoid
>> * block layer merges for the request.
>> */
>> - if (rq->rq_flags & RQF_DONTPREP)
>> + if (blk_rq_is_seq_zoned_write(rq))
>> + blk_mq_insert_request(rq, BLK_MQ_INSERT_ORDERED);
>
> Is this OK to do without any starvation prevention ? A high LBA write that
> constantly gets requeued behind low LBA writes could end up in a timeout
> situation, no ?

Hi Damien,

Requeuing zoned writes should be exceptional and shouldn't happen often.
Such starvation can only happen if zoned writes for two different zones
are requeued over and over again. If that happens there will not only be
starvation for the write with the higher LBA but also retry count
exhaustion for the write with the lower LBA. If we agree that zoned
write retries are rare then I don't think we have to worry about
this kind of starvation.

Thanks,

Bart.