[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ystv6cvrdllh64eqkislh47a3bnx5d2lk42ox4eiuuubioin6u@gmt5pwbkwiz3>
Date: Thu, 15 May 2025 12:14:38 +0900
From: Sergey Senozhatsky <senozhatsky@...omium.org>
To: Zaslonko Mikhail <zaslonko@...ux.ibm.com>
Cc: Sergey Senozhatsky <senozhatsky@...omium.org>,
Andrew Morton <akpm@...ux-foundation.org>, Minchan Kim <minchan@...nel.org>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, Heiko Carstens <hca@...ux.ibm.com>,
Ilya Leoshkevich <iii@...ux.ibm.com>, Herbert Xu <herbert@...dor.apana.org.au>
Subject: Re: [PATCH 2/2] zram: support deflate-specific params
Cc-ing Herbert
On (25/05/14 12:58), Zaslonko Mikhail wrote:
> Looks good to me.
>
> Just a minor comment. If we intend to use raw deflate only, like we do now (no zlib header or
> trailer for the compressed data), we should probably change deflate.winbits to unsigned and
> pass '-deflate.winbits' to zlib_deflateInit2().
Yeah, so in zram we can use only raw deflate (we decompress only what we
have compressed earlier and the data never leaves the device.) But in case
of Crypto API I actually don't know, added Herbert to the Cc.
> Also, here is another patch suggestion from my side on top of this one.
> Let me know what you think.
>
> ---8<---
>
> zram: Utilize s390 hardware deflate acceleration for zram
>
> Utilize s390 hardware deflate acceleration for zram deflate compression
> by default when the facility is available.
>
> Signed-off-by: Mikhail Zaslonko <zaslonko@...ux.ibm.com>
>
> diff --git a/drivers/block/zram/backend_deflate.c b/drivers/block/zram/backend_deflate.c
> index b75016e0e654..5bfc57522e3a 100644
> --- a/drivers/block/zram/backend_deflate.c
> +++ b/drivers/block/zram/backend_deflate.c
> @@ -22,10 +22,23 @@ static void deflate_release_params(struct zcomp_params *params)
>
> static int deflate_setup_params(struct zcomp_params *params)
> {
> - if (params->level == ZCOMP_PARAM_NOT_SET)
> - params->level = Z_DEFAULT_COMPRESSION;
> - if (params->deflate.winbits == ZCOMP_PARAM_NOT_SET)
> - params->deflate.winbits = DEFLATE_DEF_WINBITS;
> + /*
> + * In case of s390 zlib hardware support available,
> + * use maximum window size and level one as default compression
> + * parameters in order to utilize hardware deflate acceleration.
> + */
> + if (params->level == ZCOMP_PARAM_NOT_SET) {
> + if (zlib_deflate_dfltcc_enabled())
> + params->level = Z_BEST_SPEED;
> + else
> + params->level = Z_DEFAULT_COMPRESSION;
> + }
> + if (params->deflate.winbits == ZCOMP_PARAM_NOT_SET) {
> + if (zlib_deflate_dfltcc_enabled())
> + params->deflate.winbits = -MAX_WBITS;
> + else
> + params->deflate.winbits = DEFLATE_DEF_WINBITS;
> + }
I'm not sure if we want this much of s390 specific code in the generic
zram/Crypto API code. Both of these params can be configured by user-space
via the algorithm_params device attribute.
Powered by blists - more mailing lists