On 1/9/23 20:59, Dmitry Safonov wrote: > Hi Jakub, > > Thanks for taking a look and your review, > > On 1/7/23 01:53, Jakub Kicinski wrote: [..] >>> +static int crypto_pool_scratch_alloc(void) >> >> This isn't called by anything in this patch.. >> crypto_pool_alloc_ahash() should call it I'm guessing? > > Ah, this is little historical left-over: in the beginning, I used > constant-sized area as "scratch" buffer, the way TCP-MD5 does it. > Later, while converting users to crypto_pool, I found that it would be > helpful to support simple resizing as users have different size > requirement to the temporary buffer, i.e. looking at xfrm_ipcomp, if > later it would be converted to use the same API, rather than its own: > IPCOMP_SCRATCH_SIZE is huge (which may help to save quite some memory if > shared with other crypto_pool users: as the buffer is as well protected > by bh-disabled section, the usage pattern is quite the same). > > In patch 2 I rewrote it for crypto_pool_reserve_scratch(). The purpose > of patch 2 was to only add dynamic up-sizing of this buffer to make it > easier to review the change. So, here are 2 options: > - I can move scratch area allocation/resizing/freeing to patch2 for v3 > - Or I can keep patch 2 for only adding the resizing functionality, but > in patch 1 make crypto_pool_scratch_alloc() non-static and to the header > API. > > What would you prefer? Taking the question off: in v3 I'll provide "size" as another argument in patch 2 (the way you suggested it in review for patch 2). That way dynamic allocation would be still separated in patch 2. Thanks, Dmitry