All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc MERLIN <marc@merlins.org>
To: Milan Broz <mbroz@redhat.com>
Cc: dm-crypt@saout.de, Yves-Alexis Perez <corsac@debian.org>
Subject: Re: [dm-crypt] aes-xts-plain with aes_x86_64 makes my SSD 5x slower than my encrypted HD
Date: Mon, 23 Jul 2012 22:57:22 -0700	[thread overview]
Message-ID: <20120724055722.GA15507@merlins.org> (raw)
In-Reply-To: <500DC2B0.8060409@redhat.com>

On Mon, Jul 23, 2012 at 11:31:28PM +0200, Milan Broz wrote:
> On 07/23/2012 07:51 PM, Marc MERLIN wrote:
> > On Mon, Jul 23, 2012 at 07:15:24PM +0200, Milan Broz wrote:
> >>> Mmmh, I have one possible thing. I have a preempt kernel. Could that be it?
> >>> http://marc.merlins.org/tmp/config-3.4.4-amd64-preempt.txt
> >>
> >> Can you send me your kernel .config then? Preempt should not be problem.
> >> Which kernel version? which architecture? Any additional patches over
> >> mainline code?
> > 
> > I just sent you my config, it was in the URL above :)
> > No patches, kernel 3.4.4 from kernel.org, see above.
> 
> Ehm... sorry, I completely missed that. Thanks.
 
Mmmh, so I installed "standard" linux-image-3.2.0-3-amd64 from debian.
And....
nothing changed :(

/dev/mapper/cryptroot:
 Timing cached reads:   19642 MB in  2.00 seconds = 9833.88 MB/sec
 Timing buffered disk reads:  72 MB in  3.05 seconds =  23.59 MB/sec

Did you find anything more useful here:
http://marc.merlins.org/tmp/blktrace.txt

Or can I take another blktrace that helps?

> > Really?
> > I used fdisk -H32 -S32 /dev/sda as recomended on
> > http://www.void.gr/kargig/blog/2012/01/11/linux-ssd-partition-alignment-tips/
> 
> Do not use -H32 -S32. It is crazy and obsolete way how to align it...
> Someone is wrong in the internet seems http://xkcd.com/386/ ;-)

Yes, I know the cartoon :)
Mmmh, so I'll have to reformat everything so that all my partition start numbers
are multiple of 512.
Maybe I can get parted to move at least partition #4 without losing all my
data. I'll try that.

However is using
cryptsetup luksFormat --align-payload=8192
still the right thing for me?
(with the understanding that alignment shouldn't really an issue for reads,
but for writes)

> Disk driver should set topology parameters which fdisk uses. But for your
> case all is set to 512 bytes...
> 
> Whatever, there was a bug in fdisk, fixed now thanks to your report :)
> https://github.com/karelzak/util-linux/commit/c0175e6185ac81843cbad33cbea75abd033f0e66

Cool, thanks for that.

Ok, so I repartitioned my first 3 partitions, which I could do without
losing data:
Disk /dev/sda: 512.1 GB, 512110190592 bytes
255 heads, 63 sectors/track, 62260 cylinders, total 1000215216 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x09aaf50a

  Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      502271      250112   83  Linux
/dev/sda2          502272    52930559    26214144   83  Linux
/dev/sda3        52930560    73902079    10485760   82  Linux swap / Solaris
/dev/sda4        73902368  1000215215   463156424   83  Linux

OMG, that actually helped:
gandalfthegreat:~# echo test | cryptsetup create -c null test_crypt /dev/sda2
gandalfthegreat:~# hdparm -t -T /dev/mapper/test_crypt 
/dev/mapper/test_crypt:
 Timing cached reads:   18186 MB in  2.00 seconds = 9103.83 MB/sec
 Timing buffered disk reads: 524 MB in  3.04 seconds = 172.63 MB/sec

But with LUKS, it falls apart:
gandalfthegreat:~# cryptsetup luksFormat --align-payload=8192 -c aes-xts-plain -s 256 /dev/sda2 
(...)
gandalfthegreat:~# cryptsetup luksOpen --allow-discards /dev/sda2 test
(...)
gandalfthegreat:~# hdparm -t -T /dev/mapper/test
/dev/mapper/test:
 Timing cached reads:   17436 MB in  2.00 seconds = 8728.61 MB/sec
 Timing buffered disk reads:  74 MB in  3.03 seconds =  24.44 MB/sec

Grumble.

So
1) alignement has some effect and I'm not sure how to get luksFormat aligned right
2) Even in the better case above, 172.63 MB/sec is too slow. I was getting faster 
speeds by dding a file from potentially the encrypted filesystem.

If blktrace doesn't show anything useful, is there anything else I can capture?

Thanks,
Marc
-- 
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
                                      .... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/  

  reply	other threads:[~2012-07-24  5:57 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-22 19:07 [dm-crypt] aes-xts-plain with aes_x86_64 makes my SSD 5x slower than my encrypted HD Marc MERLIN
2012-07-22 19:47 ` Yves-Alexis Perez
2012-07-22 20:39   ` Marc MERLIN
2012-07-22 21:47     ` Arno Wagner
2012-07-23  6:07       ` Yves-Alexis Perez
2012-07-23  6:28       ` Marc MERLIN
2012-07-23  8:14         ` Arno Wagner
2012-07-23 10:46           ` Milan Broz
2012-07-23 11:09             ` Yves-Alexis Perez
2012-07-23 11:37               ` Milan Broz
2012-07-23 15:08                 ` André Gall
2012-07-23 17:27                 ` André Gall
2012-07-24 14:06             ` Heinz Diehl
2012-07-24 14:16               ` Milan Broz
2012-07-23 16:12           ` Marc MERLIN
2012-07-23 16:19             ` Yves-Alexis Perez
2012-07-23 17:54               ` Marc MERLIN
2012-07-23 19:26                 ` Yves-Alexis Perez
2012-07-23 17:15             ` Milan Broz
2012-07-23 17:51               ` Marc MERLIN
2012-07-23 21:31                 ` Milan Broz
2012-07-24  5:57                   ` Marc MERLIN [this message]
2012-07-24  6:25                     ` Heinz Diehl
2012-07-24 15:02                       ` Marc MERLIN
2012-07-24 15:19                         ` Milan Broz
2012-07-24 16:09                           ` Marc MERLIN
2012-07-24 13:54                     ` Milan Broz
     [not found]                       ` <500E9099.8050501@redhat.com>
2012-07-24 14:27                       ` Heinz Diehl
2012-07-24 14:58                         ` Heinz Diehl
2012-07-24 15:38                           ` Marc MERLIN
2012-07-24 16:48                             ` Heinz Diehl
2012-07-24  6:11                   ` Heinz Diehl
2012-07-22 21:55     ` Marc MERLIN
2012-07-22 20:22 ` Heinz Diehl
2012-08-12 12:49 ` Pasi Kärkkäinen
2012-08-16  7:43   ` Marc MERLIN
     [not found]     ` <502D1F96.3080905@andregall.de>
2012-08-16 17:57       ` Marc MERLIN

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=20120724055722.GA15507@merlins.org \
    --to=marc@merlins.org \
    --cc=corsac@debian.org \
    --cc=dm-crypt@saout.de \
    --cc=mbroz@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.