* [PATCH v2 RESEND] block: rename need_dispatch to piecemeal_dispatch in blk-mq sched
@ 2026-11-19 7:17 Guixin Liu
0 siblings, 0 replies; only message in thread
From: Guixin Liu @ 2026-11-19 7:17 UTC (permalink / raw)
To: Jens Axboe, Christoph Hellwig, Tejun Heo, Josef Bacik,
Nilay Shroff, Ming Lei, Hannes Reinecke
Cc: linux-block
The local boolean in __blk_mq_sched_dispatch_requests() decides whether
to fall back to the per-ctx round-robin path (blk_mq_do_dispatch_ctx())
instead of the batch flush path (blk_mq_flush_busy_ctxs()). The whole
function is about dispatching anyway, so the name "need_dispatch" is
not particularly informative and can mislead readers into thinking that
a false value means "skip dispatching".
Rename it to "piecemeal_dispatch" to match the comment right above the
check ("dequeue request one by one from sw queue if queue is busy")
and to convey the actual intent: take the piecemeal, fair, one-at-a-time
path either when we just drained hctx->dispatch (so the device has
recently pushed back) or when the dispatch_busy EWMA still indicates
congestion. The fast batch path is only taken when neither signal
suggests recent backpressure.
No functional change.
Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
---
Resend of v2, which received no comments. The code in the function is
unchanged since then; rebased on top of v7.4-rc1 to refresh the context.
v2: https://lore.kernel.org/linux-block/20260528084416.2336836-1-kanie@linux.alibaba.com
v1: https://lore.kernel.org/linux-block/20260526131103.3105411-1-kanie@linux.alibaba.com
v2 -> v1:
- Change cautious_dispatch to piecemeal_dispatch, the advice from Jens.
block/blk-mq-sched.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c
index d7b45778732b..e9f2ded56471 100644
--- a/block/blk-mq-sched.c
+++ b/block/blk-mq-sched.c
@@ -267,7 +267,7 @@ static int blk_mq_do_dispatch_ctx(struct blk_mq_hw_ctx *hctx)
static int __blk_mq_sched_dispatch_requests(struct blk_mq_hw_ctx *hctx)
{
- bool need_dispatch = false;
+ bool piecemeal_dispatch = false;
LIST_HEAD(rq_list);
/*
@@ -298,16 +298,16 @@ static int __blk_mq_sched_dispatch_requests(struct blk_mq_hw_ctx *hctx)
blk_mq_sched_mark_restart_hctx(hctx);
if (!blk_mq_dispatch_rq_list(hctx, &rq_list, true))
return 0;
- need_dispatch = true;
+ piecemeal_dispatch = true;
} else {
- need_dispatch = hctx->dispatch_busy;
+ piecemeal_dispatch = hctx->dispatch_busy;
}
if (hctx->queue->elevator)
return blk_mq_do_dispatch_sched(hctx);
/* dequeue request one by one from sw queue if queue is busy */
- if (need_dispatch)
+ if (piecemeal_dispatch)
return blk_mq_do_dispatch_ctx(hctx);
blk_mq_flush_busy_ctxs(hctx, &rq_list);
blk_mq_dispatch_rq_list(hctx, &rq_list, true);
--
2.43.7
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-19 7:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19 7:17 [PATCH v2 RESEND] block: rename need_dispatch to piecemeal_dispatch in blk-mq sched Guixin Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox