LKML Archive on
help / color / mirror / Atom feed
From: Martijn Coenen <>
To: Chaitanya Kulkarni <>
Cc: "" <>, "" <>,
	"" <>,
	"" <>,
	"" <>,
	"" <>
Subject: Re: [PATCH] loop: Only change blocksize when needed.
Date: Wed, 11 Mar 2020 09:42:18 +0100	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

Hi Chaitanya,

On Tue, Mar 10, 2020 at 9:23 PM Chaitanya Kulkarni
<> wrote:
> Logically this is a right thing to do, but I wonder how much speedup
> you are getting with these improvements ?
> It will be great if you have some numbers so we all know the speedup.

What makes blk_mq_freeze_queue() relatively expensive is that the
implementation of that function calls synchronize_rcu() (for good
reasons); on our x86 devices, I've seen that take 15-20ms on average.
Recent Android versions configure a lot (~30) of loop devices at boot,
and so this saves us about 600ms of boot time. I strongly suspect this
benefits other usecases besides Android.

There is another call in loop_set_status() which is harder to remove;
eg, if you use loop_set_status() to change the offset of a loop
device, you shouldn't do that if there are still requests outstanding,
and blk_mq_freeze_queue() ensures that. But in our specific case, we
know that there won't be requests outstanding, because during this
phase of boot the loop device hasn't been mounted yet. But we can't
tell the kernel that. So I will follow up with a patch that tries to
address that issue, which will also have some more detailed numbers.
If you have ideas or suggestions, feel free to let me know!


> Irrespective of that, this looks good to me.
> Reviewed-by: Chaitanya Kulkarni <>
> On 03/10/2020 06:17 AM, Martijn Coenen wrote:
> > Return early in loop_set_block_size() if the requested block size is
> > identical to the one we already have; this avoids expensive calls to
> > freeze the block queue.
> >
> > Signed-off-by: Martijn Coenen<>

      reply	other threads:[~2020-03-11  8:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-10 13:12 Martijn Coenen
2020-03-10 17:48 ` Christoph Hellwig
2020-03-10 20:11 ` Jens Axboe
2020-03-10 20:23 ` Chaitanya Kulkarni
2020-03-11  8:42   ` Martijn Coenen [this message]

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:

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

  git send-email \
    --in-reply-to='' \ \ \ \ \ \ \ \ \
    --subject='Re: [PATCH] loop: Only change blocksize when needed.' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).