On (24/05/31 16:29), Herbert Xu wrote: > On Fri, May 31, 2024 at 03:34:44PM +0900, Sergey Senozhatsky wrote: > > > > So passing "raw" algorithm parameters to crypto_scomp_setparam(tfm) can be > > suboptimal, depending on the compression driver. For instance, for zstd > > (what is currently done in zram [1]) we pre-process "raw" parameters: > > parse dictionary in order to get zstd_cdict and zstd_ddict which are then > > shared by all tfm-s (as they access C/D dictionaries in read-only mode). > > For zram/zswap doing this per-tfm would result in extra per-CPU > > zstd_cdict/zstd_ddict allocations, which is a significant overhead. > > If they share the dictionary, why can't they just share the > tfm directly? Or do you actually need to vary the other parameters > while keeping the dictionary the same? Is it possible to share a tfm? I thought that tfm-s carry some state (compression workmem/scratch buffer) so one cannot do parallel compressions on different CPUs using the same tfm.