lkml.org 
[lkml]   [2011]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] dm: verity target
Hi.

On Mon, Nov 14, 2011 at 09:54:23AM -0800, Mandeep Singh Baines wrote:
>
> Hi Steffen,
>
> We use a hash per CPU to avoid allocating and freeing a context per
> computation. We could allocate the context on the stack as you suggest.
> However, we were worried about overflowing the stack. The context can be
> quite large (close to 200 bytes for sha512).

Indeed, but preallocating on percpu basis can be also quite large on
bigsmp machines.

>
> We use a hash per CPU because there can be at most one hash in progress
> on each CPU at any one time.
>

Ok, this is the case because you use a workqueue and this processes
at most one work item on each cpu the time.

On another note, you might want to use ahash here. Most crypto hardware
accelerators need to use asynchronous ciphers. These can't be used if
you use the synchronous interface.

And at the latest when you switch to ahash, you need more than one
preallocated ahash request on each cpu, as there can be many ahash
requests submitted on each cpu :)



\
 
 \ /
  Last update: 2011-11-15 10:21    [W:0.537 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site