On 4/10/23 00:53, Damien Le Moal wrote:
On 4/8/23 08:58, Bart Van Assche wrote:
@@ -2065,9 +2057,14 @@ bool blk_mq_dispatch_rq_list(struct blk_mq_hw_ctx *hctx, struct list_head *list,
if (nr_budgets)
blk_mq_release_budgets(q, list);
- spin_lock(&hctx->lock);
- list_splice_tail_init(list, &hctx->dispatch);
- spin_unlock(&hctx->lock);
+ if (!q->elevator) {
+ spin_lock(&hctx->lock);
+ list_splice_tail_init(list, &hctx->dispatch);
+ spin_unlock(&hctx->lock);
+ } else {
+ q->elevator->type->ops.insert_requests(hctx, list,
+ /*at_head=*/true);
Dispatch at head = true ? Why ? This seems wrong. It may be valid for the
requeue case (even then, I am not convinced), but looks very wrong for the
regular dispatch case.
Hi Damien,
blk_mq_sched_dispatch_requests() dispatches requests from hctx->dispatch
before it checks whether any requests can be dispatched from the I/O
scheduler. As one can see in the quoted change above,
blk_mq_dispatch_rq_list() moves any requests that could not be
dispatched to the hctx->dispatch dispatch list. Since
blk_mq_sched_dispatch_requests() processes the dispatch list first, this
comes down to insertion at the head of the list. Hence the at_head=true
argument in the call to insert_requests().
Thanks,
Bart.