Message ID | 20250303084724.6490-1-kanchana.p.sridhar@intel.com (mailing list archive) |
---|---|
Headers | show |
Series | zswap IAA compress batching | expand |
This commit adds a get_batch_size() interface to: struct acomp_alg struct crypto_acomp A crypto_acomp compression algorithm that supports batching of compressions and decompressions must register and provide an implementation for this API, so that higher level modules such as zswap and zram can allocate resources for submitting multiple compress/decompress jobs that can be batched. In addition, the compression algorithm must register itself to use request chaining (cra_flags |= CRYPTO_ALG_REQ_CHAIN). A new helper function acomp_has_async_batching() can be invoked to query if a crypto_acomp has registered this API. Further, the newly added crypto_acomp API "crypto_acomp_batch_size()" is provided for use by higher level modules like zswap and zram. crypto_acomp_batch_size() returns 1 if the acomp has not provided an implementation for get_batch_size(). For instance, zswap can call crypto_acomp_batch_size() to get the maximum batch-size supported by the compressor. Based on this, zswap can use the minimum of any zswap-specific upper limits for batch-size and the compressor's max batch-size, to allocate batching resources. Further, the way that zswap can avail of the compressor's batching capability is by using request chaining to create a list requests chained to a head request. zswap can call crypto_acomp_compress() or crypto_acomp_decompress() with the head request in the chain for processing the chain as a batch. The call into crypto for compress/decompress will thus remain the same from zswap's perspective for both, batching and sequential compressions/decompressions