[dm-crypt] dm-crypt performance
tj at kernel.org
Thu Mar 28 20:44:43 CET 2013
On Thu, Mar 28, 2013 at 03:33:43PM -0400, Vivek Goyal wrote:
> I am curious why out of order bio is a problem. Doesn't the elevator
> already merge bio's with existing requests and if merging does not
> happen then requests are sorted in order. So why ordering is not
> happening properly with dm-crypt. What additional info dm-crypt has
> that it can do better ordering than IO scheduler.
Hmmm... well, for one, it doesn't only change ordering. It also
changes the timings. Before iosched would get contiguous stream of
IOs when the queue gets unplugged (BTW, how does dm crypt handling
plugging? If not handled properly, it could definitely affect a lot
of things.) With multiple threads doing encryption in the middle, the
iosched could get scattered IOs which could easily span multiple
millisecs. Even if context tagging was done properly, it could easily
lead to much less efficient IO patterns to hardware.
Keeping IO order combined with proper plug handling would not only
keep the ordering constant but also the relative timing of events,
which is an important factor when scheduling IOs.
> CFQ might seeing more performance hit because we maintain per
> process queues and kernel threads might not be sharing the IO context
> (i am not sure). So if all the crypto threads can share the IO
> context, atleast it will make sure all IO from them goes into a
> single queue.
Right, this is important too although I fail to see how workqueue
vs. custom dispatch would make any difference here. dm-crypt should
definitely be using bio_associate_current().
More information about the dm-crypt