Linux block layer
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Cc: paolo.valente@linaro.org, linux-block@vger.kernel.org,
	Ben Hutchings <ben@decadent.org.uk>
Subject: Re: blk-mq 5-8 times slower for bmap-tools
Date: Fri, 17 Aug 2018 15:23:49 -0600	[thread overview]
Message-ID: <483184b2-dc24-6122-a4cb-fa897f63764c@kernel.dk> (raw)
In-Reply-To: <CAPybu_3vRRO5360gUoEoPQFJd4xmBxmOZVFKhooaT4ZginT+eg@mail.gmail.com>

On 8/17/18 11:49 AM, Ricardo Ribalda Delgado wrote:
> Hi Jens
> On Fri, Aug 17, 2018 at 7:41 PM Jens Axboe <axboe@kernel.dk> wrote:
>>
>> On 8/17/18 11:39 AM, Ricardo Ribalda Delgado wrote:
>>> Hello Paolo
>>> On Fri, Aug 17, 2018 at 7:35 PM Paolo Valente <paolo.valente@linaro.org> wrote:
>>>>
>>>>
>>>>
>>>>> Il giorno 17 ago 2018, alle ore 19:31, Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> ha scritto:
>>>>>
>>>>> Hello
>>>>>
>>>>> Coming from: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=906328
>>>>>
>>>>> bmaptools is kind of a "smart dd" tool, that lets you write images
>>>>> very fast and securely. Since the last Debian Kernel update it has
>>>>> become 5-8 times slower.
>>>>>
>>>>> After some debugging, we have figured out that the reason for that
>>>>> slowness is the Multi-Queue Block IO Queueing Mechanism.
>>>>>
>>>>> Debian maintainer has pointed out that in the near future the single
>>>>> queue will be deprecated.
>>>>>
>>>>> My question is if we can get a similar perfomance for bmaptools with
>>>>> blk-mq and how?
>>>>>
>>>>
>>>> Have you also checked what happens after switching to a different I/O
>>>> scheduler for the involved drive (among none, mq-deadline, bfq and
>>>> kyber)?
>>>
>>> I have only tried mq-deadline and none (because they are enabled by
>>> default on Debian). Both produce results in the same range: 5-8 times
>>> slower.
>>>
>>> I could easily enable kyber:
>>> cat /boot/config-4.17.0-1-amd64  | grep CONFIG_MQ_IOSCHED
>>> CONFIG_MQ_IOSCHED_DEADLINE=y
>>> CONFIG_MQ_IOSCHED_KYBER=m
>>>
>>> But I left the card reader on the office, so any test would have to
>>> wait until monday sorry :(
>>
>> Can someone describe what bmaptools does? IOW, how is it different than
>> dd? Does it use multiple threads for both reads and writes?
> 
> https://github.com/intel/bmap-tools/blob/master/bmaptools/BmapCopy.py
> 
> I am not an author, just a user. But from the code it looks like
> 
> 1) sets the io scheduler to noop
> 2) Copy the file in chuncks of block_size (4096 by default)
> 3) fflush
> 4) restore io scheduler

That seems like a very odd tool... Why would you switch to noop for
a file-to-dev copy?!

In any case, I ran it on a USB stick here.

With blk-mq: bmaptool: info: copying time: 9.5s, copying speed 27.0 MiB/sec
Without blk-mq: bmaptool: info: copying time: 9.5s, copying speed 26.8 MiB/sec

which seems identical to me, maybe a slight edge to blk-mq.

For both cases, I used --nobmap since the tool complained:

bmaptool: ERROR: bmap file not found, please, use --nobmap option to flash without bmap.

I used a 256MB file full of random data. I then ran it with a 1G file, and
the results were:

With blk-mq: bmaptool: info: copying time: 36.8s, copying speed 27.8 MiB/sec
Without blk-mq: bmaptool: info: copying time: 38.6s, copying speed 26.5 MiB/sec

which also doesn't seem slower, quite the contrary.

-- 
Jens Axboe

  reply	other threads:[~2018-08-17 21:23 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-17 17:31 blk-mq 5-8 times slower for bmap-tools Ricardo Ribalda Delgado
2018-08-17 17:35 ` Paolo Valente
2018-08-17 17:39   ` Ricardo Ribalda Delgado
2018-08-17 17:41     ` Jens Axboe
2018-08-17 17:49       ` Ricardo Ribalda Delgado
2018-08-17 21:23         ` Jens Axboe [this message]
2018-08-17 17:42     ` Paolo Valente
2018-08-17 17:52       ` Ricardo Ribalda Delgado
2018-08-17 23:43 ` Ming Lei
     [not found]   ` <CAPybu_2ke4usj9Qwr9iSKTymAk1510pzZnZAgLemRB+cK4Se1A@mail.gmail.com>
2018-08-20  8:30     ` Ming Lei
2018-08-20  9:04       ` Ricardo Ribalda Delgado
2018-08-20  9:55         ` Ming Lei
2018-08-20  9:56           ` Ricardo Ribalda Delgado
2018-08-20 10:15             ` Ming Lei
2018-08-20 11:42               ` Ming Lei
2018-08-20 11:45                 ` Ming Lei
2018-08-22 19:22         ` Ben Hutchings
2018-08-22 22:02           ` Ming Lei
2018-08-23  0:51             ` Ben Hutchings
2018-08-23  2:17               ` Ming Lei
2018-08-23  6:29           ` Ricardo Ribalda Delgado

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=483184b2-dc24-6122-a4cb-fa897f63764c@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=ben@decadent.org.uk \
    --cc=linux-block@vger.kernel.org \
    --cc=paolo.valente@linaro.org \
    --cc=ricardo.ribalda@gmail.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