* [PATCH] block: avoid to quiesce queue in elevator_init_mq
@ 2021-11-17 11:55 Ming Lei
2021-11-17 14:43 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Ming Lei @ 2021-11-17 11:55 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-block, Ming Lei, yangerkun, Damien Le Moal
elevator_init_mq() is only called before adding disk, when there isn't
any FS I/O, only passthrough requests can be queued, so freezing queue
plus canceling dispatch work is enough to drain any dispatch activities,
then we can avoid synchronize_srcu() in blk_mq_quiesce_queue().
Long boot latency issue can be fixed in case of lots of disks added
during booting.
Fixes: 737eb78e82d5 ("block: Delay default elevator initialization")
Reported-by: yangerkun <yangerkun@huawei.com>
Cc: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
block/elevator.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/block/elevator.c b/block/elevator.c
index 1f39f6e8ebb9..19a78d5516ba 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -694,12 +694,18 @@ void elevator_init_mq(struct request_queue *q)
if (!e)
return;
+ /*
+ * We are called before adding disk, when there isn't any FS I/O,
+ * so freezing queue plus canceling dispatch work is enough to
+ * drain any dispatch activities originated from passthrough
+ * requests, then no need to quiesce queue which may add long boot
+ * latency, especially when lots of disks are involved.
+ */
blk_mq_freeze_queue(q);
- blk_mq_quiesce_queue(q);
+ blk_mq_cancel_work_sync(q);
err = blk_mq_init_sched(q, e);
- blk_mq_unquiesce_queue(q);
blk_mq_unfreeze_queue(q);
if (err) {
--
2.31.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] block: avoid to quiesce queue in elevator_init_mq
2021-11-17 11:55 [PATCH] block: avoid to quiesce queue in elevator_init_mq Ming Lei
@ 2021-11-17 14:43 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2021-11-17 14:43 UTC (permalink / raw)
To: Ming Lei; +Cc: linux-block, yangerkun, Damien Le Moal
On Wed, 17 Nov 2021 19:55:02 +0800, Ming Lei wrote:
> elevator_init_mq() is only called before adding disk, when there isn't
> any FS I/O, only passthrough requests can be queued, so freezing queue
> plus canceling dispatch work is enough to drain any dispatch activities,
> then we can avoid synchronize_srcu() in blk_mq_quiesce_queue().
>
> Long boot latency issue can be fixed in case of lots of disks added
> during booting.
>
> [...]
Applied, thanks!
[1/1] block: avoid to quiesce queue in elevator_init_mq
commit: 245a489e81e13dd55ae46d27becf6d5901eb7828
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-11-17 14:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-17 11:55 [PATCH] block: avoid to quiesce queue in elevator_init_mq Ming Lei
2021-11-17 14:43 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox