[dm-crypt] aes-xts-plain with aes_x86_64 makes my SSD 5x slower than my encrypted HD

Marc MERLIN marc at merlins.org
Tue Jul 24 17:02:47 CEST 2012


On Tue, Jul 24, 2012 at 08:25:18AM +0200, Heinz Diehl wrote:
> Please correct me if I should be wrong, but your drive should report
> 512/4096 here, so it lies about the real blocksize it uses (4k).
> This raises the question if you have created your filesystem on top of
> the encrypted partition with e.g. "-b 4096".

I'm using btrfs, which defaults to 4K blocks. Also, I was I seeing 270MB/s
reading a big file with btrfs on top of cryptroot.

On Tue, Jul 24, 2012 at 10:44:36AM +0200, Milan Broz wrote:
> Seems I am running out of ideas :)
> (I just read the mails again and I think I am missing something
> obvious. Whatever, I will return to it later.)

I wanted to command you for not giving up, you definitely went the extra
mile :)
 
> btw why is in blktrace process generating IO in log [bash]
> and not [dd] or [hdparm] ?

I noticed that. I used dd that time so that I could force an entire
GB of data, and I was also surprised that it showed up in bash when
indeed I did:
gandalfthegreat:~# dd if=/dev/mapper/cryptroot of=/dev/null bs=1M count=1024

> Apparently you generated it with dd. (But maybe just old blktrace),
> I have # blktrace --version
> blktrace version 2.0.0
 
Same version here.

On Tue, Jul 24, 2012 at 03:54:06PM +0200, Milan Broz wrote:
> So. Can you please try to increase readahead (and also run it with direct-io)?
> Just to check if it is the same problem or not...

So, direct IO is faster but not as fast as it should, and ....
readahead fixes it!

gandalfthegreat:~# hdparm --direct -t /dev/mapper/cryptroot 
/dev/mapper/cryptroot:
 Timing O_DIRECT disk reads: 242 MB in  3.02 seconds =  80.26 MB/sec

gandalfthegreat:~# dd if=/dev/mapper/cryptroot of=/dev/null bs=1M count=1024 iflag=direct
1073741824 bytes (1.1 GB) copied, 18.4517 s, 58.2 MB/s

gandalfthegreat:~# blockdev --setra 8192 /dev/mapper/cryptroot 
gandalfthegreat:~# hdparm --direct -t /dev/mapper/cryptroot 
/dev/mapper/cryptroot:
 Timing O_DIRECT disk reads: 256 MB in  3.01 seconds =  85.10 MB/sec

gandalfthegreat:~# dd if=/dev/mapper/cryptroot of=/dev/null bs=1M count=1024 iflag=direct
1073741824 bytes (1.1 GB) copied, 16.7627 s, 64.1 MB/s

But non dirct IO is now fast:
gandalfthegreat:~# hdparm -t /dev/mapper/cryptroot 
/dev/mapper/cryptroot:
 Timing buffered disk reads: 784 MB in  3.00 seconds = 261.08 MB/sec

gandalfthegreat:~# dd if=/dev/mapper/cryptroot of=/dev/null bs=1M count=1024
1073741824 bytes (1.1 GB) copied, 3.82117 s, 281 MB/s

A big thank you helping me track this down.

Obviously for now I'll make sure I have this in my initscripts, and while
your direct IO is much faster than mine (weird), it looks like you can
reproduce this too in the non direct IO case at least.
Hopefully that'll help fix the kernel. 

Feel free to ping me if there are kernel patches you'd like me to try before
submission.

Thanks again,
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/  


More information about the dm-crypt mailing list