Re: [PATCH v2 13/20] s390/zcrypt: Add small mempool for cca info list entries

Holger Dengler
2025-03-20T16:05:23Z

On 04/03/2025 18:21, Harald Freudenberger wrote:
> Add a small memory pool for (pre-)allocating cca info list
> entries. These entries are rather small and the pool is a simple
> way to support the xflag ZCRYPT_XFLAG_NOMEMALLOC to avoid mallocs.
>
> Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>

Sorry, I forgot one aspect, see comment below.

> ---
> drivers/s390/crypto/zcrypt_ccamisc.c | 67 ++++++++++++++++++++--------
> drivers/s390/crypto/zcrypt_ccamisc.h | 3 +-
> drivers/s390/crypto/zcrypt_cex4.c | 4 +-
> 3 files changed, 53 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/s390/crypto/zcrypt_ccamisc.c b/drivers/s390/crypto/zcrypt_ccamisc.c
> index ff7ba2622484..e4ec922aae0d 100644
> --- a/drivers/s390/crypto/zcrypt_ccamisc.c
> +++ b/drivers/s390/crypto/zcrypt_ccamisc.c
> @@ -41,6 +41,10 @@ struct cca_info_list_entry {
> static LIST_HEAD(cca_info_list);
> static DEFINE_SPINLOCK(cca_info_list_lock);
>
> +/* memory pool for cca_info_list entries */
> +#define INFO_ENTRY_MEMPOOL_MIN_ITEMS 8
> +static mempool_t *info_mempool;
> +

The minimal elements in all smaller mempools should also be configurable via a module parameter, if this is required to process a larger number of NOMEMALLOC requests in parallel. There should be one parameter per module, which configures the minimal number of all mempools of this module. I also would prefer the same parameter name across all modules (e.g. "mempool_threshold").

--
Mit freundlichen Grüßen / Kind regards
Holger Dengler
--
IBM Systems, Linux on IBM Z Development
dengler@linux.ibm.com