[QUESTION] blk_mq_freeze_queue in elevator_init_mq
Ming Lei
ming.lei at redhat.com
Wed Nov 17 02:19:29 PST 2021
On Wed, Nov 17, 2021 at 05:00:22PM +0800, yangerkun wrote:
>
>
> On 2021/11/17 16:06, Ming Lei wrote:
> > On Wed, Nov 17, 2021 at 11:37:13AM +0800, yangerkun wrote:
> > > Nowdays we meet the boot regression while enable lots of mtdblock
> >
> > What is your boot regression? Any dmesg log?
>
> The result is that when boot with 5.10 kernel compare with 4.4, 5.10
> will consume about 1.6s more...
OK, I understand the issue now, and please try the attached patch
which depends on the following one:
https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git/commit/?h=block-5.16&id=2a19b28f7929866e1cec92a3619f4de9f2d20005
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) {
thanks,
Ming
More information about the linux-mtd
mailing list