linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: yangerkun <yangerkun@huawei.com>
Cc: damien.lemoal@wdc.com, axboe@kernel.dk,
	miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com,
	linux-block@vger.kernel.org, linux-mtd@lists.infradead.org,
	yi.zhang@huawei.com, yebin10@huawei.com, houtao1@huawei.com,
	ming.lei@redhat.com
Subject: Re: [QUESTION] blk_mq_freeze_queue in elevator_init_mq
Date: Wed, 17 Nov 2021 18:19:29 +0800	[thread overview]
Message-ID: <YZTXMZRxvb5Orsdo@T590> (raw)
In-Reply-To: <d9ca8e57-55b8-96f8-e5fd-6103c8b1fa4b@huawei.com>

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


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2021-11-17 10:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-17  3:37 [QUESTION] blk_mq_freeze_queue in elevator_init_mq yangerkun
2021-11-17  4:11 ` Bart Van Assche
2021-11-17  8:39   ` yangerkun
2021-11-17  8:06 ` Ming Lei
2021-11-17  8:37   ` yangerkun
2021-11-17  9:00   ` yangerkun
2021-11-17 10:19     ` Ming Lei [this message]
2021-11-18 13:12       ` yangerkun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YZTXMZRxvb5Orsdo@T590 \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=damien.lemoal@wdc.com \
    --cc=houtao1@huawei.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.com \
    --cc=yangerkun@huawei.com \
    --cc=yebin10@huawei.com \
    --cc=yi.zhang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).