linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Zaslonko Mikhail <zaslonko@linux.ibm.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
	 Andrew Morton <akpm@linux-foundation.org>,
	Minchan Kim <minchan@kernel.org>,
	linux-kernel@vger.kernel.org,  linux-mm@kvack.org,
	Heiko Carstens <hca@linux.ibm.com>,
	 Ilya Leoshkevich <iii@linux.ibm.com>,
	Herbert Xu <herbert@gondor.apana.org.au>
Subject: Re: [PATCH 2/2] zram: support deflate-specific params
Date: Thu, 15 May 2025 12:14:38 +0900	[thread overview]
Message-ID: <ystv6cvrdllh64eqkislh47a3bnx5d2lk42ox4eiuuubioin6u@gmt5pwbkwiz3> (raw)
In-Reply-To: <bec7391c-e40d-4633-a2d0-881eb6d18f19@linux.ibm.com>

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@linux.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.


  reply	other threads:[~2025-05-15  3:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-14  2:47 [PATCH 0/2] zram: support algorithm-specific parameters Sergey Senozhatsky
2025-05-14  2:47 ` [PATCH 1/2] zram: rename ZCOMP_PARAM_NO_LEVEL Sergey Senozhatsky
2025-05-14 10:56   ` Zaslonko Mikhail
2025-05-14  2:47 ` [PATCH 2/2] zram: support deflate-specific params Sergey Senozhatsky
2025-05-14 10:58   ` Zaslonko Mikhail
2025-05-15  3:14     ` Sergey Senozhatsky [this message]
2025-05-15  3:17       ` Herbert Xu
2025-05-15  3:19         ` Sergey Senozhatsky
2025-05-15  3:24           ` Herbert Xu
2025-05-15  3:32             ` Sergey Senozhatsky
2025-05-15  3:38               ` Herbert Xu
2025-05-19 12:09                 ` Zaslonko Mikhail
2025-05-23 12:22       ` Zaslonko Mikhail

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ystv6cvrdllh64eqkislh47a3bnx5d2lk42ox4eiuuubioin6u@gmt5pwbkwiz3 \
    --to=senozhatsky@chromium.org \
    --cc=akpm@linux-foundation.org \
    --cc=hca@linux.ibm.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=iii@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=zaslonko@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox