Re: [PATCH v2 16/20] s390/zcrypt: Add small mempool for ep11 card info list entries

Holger Dengler
2025-03-20T16:09:15Z

On 04/03/2025 18:21, Harald Freudenberger wrote:
> Add a small memory pool for (pre-)allocating ep11 card 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>

With the change below,
Reviewed-by: Holger Dengler <dengler@linux.ibm.com>

> ---
> drivers/s390/crypto/zcrypt_ep11misc.c | 48 ++++++++++++++++++++++-----
> 1 file changed, 39 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/s390/crypto/zcrypt_ep11misc.c b/drivers/s390/crypto/zcrypt_ep11misc.c
> index af59d66bff33..a9a6fdc32464 100644
> --- a/drivers/s390/crypto/zcrypt_ep11misc.c
> +++ b/drivers/s390/crypto/zcrypt_ep11misc.c
> @@ -64,6 +64,10 @@ struct card_list_entry {
> static LIST_HEAD(card_list);
> static DEFINE_SPINLOCK(card_list_lock);
>
> +/* memory pool for card_list_entry entries */
> +#define INFO_ENTRY_MEMPOOL_MIN_ITEMS 4
> +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"). There is no need to state the card type in the module parameter again.

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