From: Mike Snitzer <snitzer@redhat.com>
To: Milan Broz <mbroz@redhat.com>
Cc: dm-devel@redhat.com, chris.mason@fusionio.com
Subject: Re: [RFC PATCH 00/20] dm-crypt: parallel processing
Date: Tue, 21 Aug 2012 09:32:39 -0400 [thread overview]
Message-ID: <20120821133239.GB3327@redhat.com> (raw)
In-Reply-To: <cover.1345477953.git.mbroz@redhat.com>
[cc'ing Chris Mason]
On Tue, Aug 21 2012 at 5:08am -0400,
Milan Broz <mbroz@redhat.com> wrote:
> Hello,
>
> I promised to Mikulas that I will post remaining of his dm-crypt parallel
> processing patchset (plus some related changes) with some comments.
>
> The problem:
>
> The current implementation (using per cpu struct) always use encryption
> on the same CPU which submitted IO.
>
> With very fast storage (usually SSD or MD RAID0) one CPU core can
> be limiting and the throughput of encrypted disk is worse in
> comparison with underlying storage.
>
> Idea here is to distribute encryption to other CPU cores/CPUs.
>
> (Side effect of patches is nice clean up dmcrypt code. :)
>
> Mikulas Patocka (20):
> dm-crypt: remove per-cpu structure
> dm-crypt: use unbound workqueue for request processing
> dm-crypt: remove completion restart
> dm-crypt: use encryption threads
> dm-crypt: Unify spinlock
> dm-crypt: Introduce an option that sets the number of threads.
> dm-crypt: don't use write queue
> dm-crypt: simplify io queue
> dm-crypt: unify io_queue and crypt_queue
> dm-crypt: don't allocate pages for a partial request.
> dm-crypt: avoid deadlock in mempools
> dm-crypt: simplify cc_pending
> dm-crypt merge convert_context and dm_crypt_io
> dm-crypt: move error handling to crypt_convert.
> dm-crypt: remove io_pending field
> dm-crypt: small changes
> dm-crypt: move temporary values to stack
> dm-crypt: offload writes to thread
> dm-crypt: retain write ordering
> dm-crypt: sort writes
>
> drivers/md/dm-crypt.c | 838 +++++++++++++++++++++++++++----------------------
> 1 file changed, 464 insertions(+), 374 deletions(-)
>
>
> My notes:
>
> I extensively tested this (on top of 3.6.0-rc2) and while I like
> simplification and the main logic (if we have enough power why
> not use other CPUs) I see several problems here.
>
> 1) The implementation is not much useful on modern CPUs with hw accelerated
> AES (with AES-NI even one core can saturate very fast storage).
> (Some optimized crypto behaves similar, like twofish optimized modules.)
>
> 2) The patchset targets linear access pattern mainly and one
> process generating IOs. (With more processes/CPUs generating IOs
> you get parallel processing even with current code.)
>
> I can see significant improvement (~30%) for linear read
> (if not using AES-NI) and if underlying storage is zero target
> (ideal situation removing scheduler from the stack).
>
> For random access pattern (and more IO producers) I cannot find
> reliable improvement except ideal zero target case (where improvement
> is always >30%). For more producers it doesn't help at all.
> I tested RAID0 over SATA disks and very fast SSD on quad core cpu,
> dmcrypt running with 1, 3 or 4 threads (and with cfq and noop scheduler)
> using fio threaded test with 1 or 4 threads.
>
> Notes to implementation:
>
> 1) Last two patches (19/20) provides sorting of IO requests, this
> logically should be done in IO scheduler.
>
> I don't think this should be in dmcrypt, if scheduler doesn't work
> properly, it should be fixed or tuned for crypt access pattern.
>
> 2) Could be kernel workqueue used/fixed here instead? Basically all it needs
> is to prefer submitting CPU, if it is busy just move work to another CPU.
>
> 3) It doesn't honour CPU hotplugging. Number of CPU is determined
> in crypt constructor. If hotplugging is used for CPU power saving,
> it will not work properly.
>
> 4) With debugging options on, everything is extremely slower
> (Perhaps bug in some debug option, I just noticed this on Fedora
> rawhide with all debug on.)
>
>
> I posted it mainly because I think this should move forward,
> whatever direction...
I had a conversation with Chris Mason, maybe 2 years ago, where he
expressed concern about dm-crypt growing too much intelligence about
parallel cpu usage. I seem to recall Chris' concern being relative to
btrfs and the requirement that IOs not get reordered (his point was any
dm-crypt change to improve cpu utilization shouldn't result in the
possibility to reorder IOs).
Could be that IO reordering isn't a concern dm-crypt (before or after
this patchset). But I just wanted to make this point so that it is kept
in mind (also allows Chris to raise any other new dm-crypt issue/concern
he might have?).
Mike
prev parent reply other threads:[~2012-08-21 13:32 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-21 9:08 [RFC PATCH 00/20] dm-crypt: parallel processing Milan Broz
2012-08-21 9:09 ` [PATCH 01/20] dm-crypt: remove per-cpu structure Mikulas Patocka
2012-08-21 9:09 ` [PATCH 02/20] dm-crypt: use unbound workqueue for request processing Mikulas Patocka
2012-08-21 9:09 ` [PATCH 03/20] dm-crypt: remove completion restart Mikulas Patocka
2012-08-21 9:09 ` [PATCH 04/20] dm-crypt: use encryption threads Mikulas Patocka
2012-08-21 9:09 ` [PATCH 05/20] dm-crypt: Unify spinlock Mikulas Patocka
2012-08-21 9:09 ` [PATCH 06/20] dm-crypt: Introduce an option that sets the number of threads Mikulas Patocka
2012-08-21 9:09 ` [PATCH 07/20] dm-crypt: don't use write queue Mikulas Patocka
2012-08-21 9:09 ` [PATCH 08/20] dm-crypt: simplify io queue Mikulas Patocka
2012-08-21 9:09 ` [PATCH 09/20] dm-crypt: unify io_queue and crypt_queue Mikulas Patocka
2012-08-21 9:09 ` [PATCH 10/20] dm-crypt: don't allocate pages for a partial request Mikulas Patocka
2012-08-21 9:09 ` [PATCH 11/20] dm-crypt: avoid deadlock in mempools Mikulas Patocka
2012-08-21 9:09 ` [PATCH 12/20] dm-crypt: simplify cc_pending Mikulas Patocka
2012-08-21 9:09 ` [PATCH 13/20] dm-crypt merge convert_context and dm_crypt_io Mikulas Patocka
2012-08-21 9:09 ` [PATCH 14/20] dm-crypt: move error handling to crypt_convert Mikulas Patocka
2012-08-21 9:09 ` [PATCH 15/20] dm-crypt: remove io_pending field Mikulas Patocka
2012-08-21 9:09 ` [PATCH 16/20] dm-crypt: small changes Mikulas Patocka
2012-08-21 9:09 ` [PATCH 17/20] dm-crypt: move temporary values to stack Mikulas Patocka
2012-08-21 9:09 ` [PATCH 18/20] dm-crypt: offload writes to thread Mikulas Patocka
2012-08-21 9:09 ` [PATCH 19/20] dm-crypt: retain write ordering Mikulas Patocka
2012-08-21 9:09 ` [PATCH 20/20] dm-crypt: sort writes Mikulas Patocka
2012-08-21 10:57 ` Alasdair G Kergon
2012-08-21 13:39 ` Mikulas Patocka
2012-08-21 9:37 ` [RFC PATCH 00/20] dm-crypt: parallel processing Milan Broz
2012-08-21 18:23 ` Tejun Heo
2012-08-21 19:26 ` Vivek Goyal
2012-08-22 10:28 ` Milan Broz
2012-08-23 20:15 ` Tejun Heo
2012-08-21 13:32 ` Mike Snitzer [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:
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=20120821133239.GB3327@redhat.com \
--to=snitzer@redhat.com \
--cc=chris.mason@fusionio.com \
--cc=dm-devel@redhat.com \
--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 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).