summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMing Lei <ming.lei@redhat.com>2021-11-17 19:55:02 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-12-01 09:04:56 +0100
commitdb8ed1e61b4922b841b47c989a0000e06acac0fe (patch)
tree8bc8ba47938a410aadf4db05ee63b7c4584f5045
parente03513f58919d9e2bc6df765ca2c9da863d03d90 (diff)
downloadlinux-stable-db8ed1e61b4922b841b47c989a0000e06acac0fe.tar.gz
linux-stable-db8ed1e61b4922b841b47c989a0000e06acac0fe.tar.bz2
linux-stable-db8ed1e61b4922b841b47c989a0000e06acac0fe.zip
block: avoid to quiesce queue in elevator_init_mq
commit 245a489e81e13dd55ae46d27becf6d5901eb7828 upstream. 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> Link: https://lore.kernel.org/r/20211117115502.1600950-1-ming.lei@redhat.com Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--block/elevator.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/block/elevator.c b/block/elevator.c
index ff45d8388f48..cd02ae332c4e 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) {