[QUESTION] blk_mq_freeze_queue in elevator_init_mq

yangerkun yangerkun at huawei.com
Tue Nov 16 19:37:13 PST 2021


Nowdays we meet the boot regression while enable lots of mtdblock
compare with 4.4. The main reason was that the blk_mq_freeze_queue in
elevator_init_mq will wait a RCU gap which want to make sure no IO will
happen while blk_mq_init_sched.

Other module like loop meets this problem too and has been fix with
follow patches:

  2112f5c1330a loop: Select I/O scheduler 'none' from inside add_disk()
  90b7198001f2 blk-mq: Introduce the BLK_MQ_F_NO_SCHED_BY_DEFAULT flag

They change the default IO scheduler for loop to 'none'. So no need to
call blk_mq_freeze_queue and blk_mq_init_sched. But it seems not
appropriate for mtdblocks. Mtdblocks can use 'mq-deadline' to help
optimize the random write with the help of mtdblock's cache. Once change
to 'none', we may meet the regression for random write.

commit 737eb78e82d52d35df166d29af32bf61992de71d
Author: Damien Le Moal <damien.lemoal at wdc.com>
Date:   Thu Sep 5 18:51:33 2019 +0900

     block: Delay default elevator initialization

     ...

     Additionally, to make sure that the elevator initialization is never
     done while requests are in-flight (there should be none when the device
     driver calls device_add_disk()), freeze and quiesce the device request
     queue before calling blk_mq_init_sched() in elevator_init_mq().
     ...

This commit add blk_mq_freeze_queue in elevator_init_mq which try to
make sure no in-flight request while we go through blk_mq_init_sched.
But does there any drivers can leave IO alive while we go through
elevator_init_mq? And if no, maybe we can just remove this logical to
fix the regression...
.
.



More information about the linux-mtd mailing list