linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Bart Van Assche <bvanassche@acm.org>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
	Jaegeuk Kim <jaegeuk@kernel.org>,
	Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
	Martijn Coenen <maco@android.com>
Subject: Re: [PATCH 1/2] loop: Prevent that an I/O scheduler is assigned
Date: Tue, 3 Aug 2021 09:54:18 +0800	[thread overview]
Message-ID: <YQihyvnN3msaNyDW@T590> (raw)
In-Reply-To: <20210803000200.4125318-2-bvanassche@acm.org>

On Mon, Aug 02, 2021 at 05:01:59PM -0700, Bart Van Assche wrote:
> Loop devices have a single hardware queue. Hence, the block layer function
> elevator_get_default() selects the mq-deadline scheduler for loop devices.
> Using the mq-deadline scheduler or any other I/O scheduler for loop devices
> incurs unnecessary overhead. Make the loop driver pass the flag
> BLK_MQ_F_NOSCHED to the block layer core such that no I/O scheduler can be
> associated with block devices. This approach has an advantage compared to
> letting udevd change the loop I/O scheduler to none, namely that
> synchronize_rcu() does not get called.
> 
> It is intentional that the flag BLK_MQ_F_SHOULD_MERGE is preserved.
> 
> This patch reduces the Android boot time on my test setup with 0.5 seconds.

Can you investigate why none reduces Android boot time? Or reproduce &
understand it by a fio simulation on your setting?

> 
> Cc: Ming Lei <ming.lei@redhat.com>
> Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Martijn Coenen <maco@android.com>
> Cc: Jaegeuk Kim <jaegeuk@kernel.org>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>  drivers/block/loop.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/block/loop.c b/drivers/block/loop.c
> index f8486d9b75a4..9fca3ab3988d 100644
> --- a/drivers/block/loop.c
> +++ b/drivers/block/loop.c
> @@ -2333,7 +2333,8 @@ static int loop_add(int i)
>  	lo->tag_set.queue_depth = 128;
>  	lo->tag_set.numa_node = NUMA_NO_NODE;
>  	lo->tag_set.cmd_size = sizeof(struct loop_cmd);
> -	lo->tag_set.flags = BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_STACKING;
> +	lo->tag_set.flags = BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_STACKING |
> +		BLK_MQ_F_NO_SCHED;

Loop directio needs io merge, so it isn't good to set NO_SCHED
unconditionally, see:

40326d8a33d5 ("block/loop: allow request merge for directio mode")

Thanks,
Ming


  reply	other threads:[~2021-08-03  1:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-03  0:01 [PATCH 0/2] Two loop driver patches Bart Van Assche
2021-08-03  0:01 ` [PATCH 1/2] loop: Prevent that an I/O scheduler is assigned Bart Van Assche
2021-08-03  1:54   ` Ming Lei [this message]
2021-08-03  5:23     ` Bart Van Assche
2021-08-03  7:18       ` Ming Lei
2021-08-03  0:02 ` [PATCH 2/2] loop: Add the default_queue_depth kernel module parameter Bart Van Assche
2021-08-03  1:57   ` Ming Lei

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=YQihyvnN3msaNyDW@T590 \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=hch@lst.de \
    --cc=jaegeuk@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=maco@android.com \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    /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).