All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
	Christoph Hellwig <hch@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Minchan Kim <minchan@kernel.org>,
	linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>,
	linux-crypto@vger.kernel.org
Subject: Re: [PATCHv3 00/19] zram: convert to custom compression API and allow algorithms tuning
Date: Fri, 10 May 2024 17:08:27 +0900	[thread overview]
Message-ID: <20240510080827.GB950946@google.com> (raw)
In-Reply-To: <Zj3PXKcpqUPuFJRu@gondor.apana.org.au>

On (24/05/10 15:40), Herbert Xu wrote:
> > But in general case, a typical crypto API usage
> > 
> > 	tfm = crypto_alloc_comp(comp->name, 0, 0);
> > 
> > should become much more complex.  I'd say that, probably, developing
> > an entirely new sub-set of API would be simpler.
> 
> We could easily add a setparams interface for acomp to support
> this.  The form of parameters would be specific to each individual
> algorithm (but obviously all drivers for the same algorithm must
> use the same format).

For some algorithms params needs to be set before ctx is created.
For example zstd, crypto/zstd calls zstd_get_params(ZSTD_DEF_LEVEL, 0)
to estimate workspace size, which misses the opportunity to configure
it an way zram/zswap can benefit from, because those work with PAGE_SIZE
source buffer.  So for zram zstd_get_params(ZSTD_DEF_LEVEL, PAGE_SIZE)
is much better (it saves 1.2MB per ctx, which is per-CPU in zram).  Not
to mention that zstd_get_params(param->level, 0) is what we need at the
end.

And then drivers need to be re-implemented to support params.  For
example, crypto/lz4 should call LZ4_compress_fast() instead of
LZ4_compress_default(), because fact() accepts compression level,
which is a tunable value.

  reply	other threads:[~2024-05-10  8:08 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-08  7:41 [PATCHv3 00/19] zram: convert to custom compression API and allow algorithms tuning Sergey Senozhatsky
2024-05-08  7:41 ` [PATCHv3 01/19] zram: move from crypto API to custom comp backends API Sergey Senozhatsky
2024-05-08  7:41 ` [PATCHv3 02/19] zram: add lzo and lzorle compression backends support Sergey Senozhatsky
2024-05-09 11:23   ` kernel test robot
2024-05-10  5:33     ` Sergey Senozhatsky
2024-05-15  5:07       ` Sergey Senozhatsky
2024-05-08  7:41 ` [PATCHv3 03/19] zram: add lz4 compression backend support Sergey Senozhatsky
2024-05-10  7:00   ` Sergey Senozhatsky
2024-05-08  7:41 ` [PATCHv3 04/19] zram: add lz4hc " Sergey Senozhatsky
2024-05-08  7:41 ` [PATCHv3 05/19] zram: add zstd " Sergey Senozhatsky
2024-05-08  7:41 ` [PATCHv3 06/19] zram: pass estimated src size hint to zstd Sergey Senozhatsky
2024-05-08  7:42 ` [PATCHv3 07/19] zram: add zlib compression backend support Sergey Senozhatsky
2024-05-08  7:42 ` [PATCHv3 08/19] zram: add 842 " Sergey Senozhatsky
2024-05-09 12:42   ` Christoph Hellwig
2024-05-10  4:43     ` Sergey Senozhatsky
2024-05-08  7:42 ` [PATCHv3 09/19] zram: check that backends array has at least one backend Sergey Senozhatsky
2024-05-08  7:42 ` [PATCHv3 10/19] zram: introduce zcomp_config structure Sergey Senozhatsky
2024-05-08  7:42 ` [PATCHv3 11/19] zram: extend comp_algorithm attr write handling Sergey Senozhatsky
2024-05-08  7:42 ` [PATCHv3 12/19] zram: support compression level comp config Sergey Senozhatsky
2024-05-08  7:42 ` [PATCHv3 13/19] zram: add support for dict " Sergey Senozhatsky
2024-05-08  7:42 ` [PATCHv3 14/19] zram: add dictionary support to zstd backend Sergey Senozhatsky
2024-05-08  7:42 ` [PATCHv3 15/19] zram: add config init/release backend callbacks Sergey Senozhatsky
2024-05-08  7:42 ` [PATCHv3 16/19] zram: share dictionaries between per-CPU contexts Sergey Senozhatsky
2024-05-08  7:42 ` [PATCHv3 17/19] zram: add dictionary support to lz4 Sergey Senozhatsky
2024-05-08  7:42 ` [PATCHv3 18/19] zram: add dictionary support to lz4hc Sergey Senozhatsky
2024-05-08  7:42 ` [PATCHv3 19/19] Documentation/zram: add documentation for algorithm parameters Sergey Senozhatsky
2024-05-09 12:43 ` [PATCHv3 00/19] zram: convert to custom compression API and allow algorithms tuning Christoph Hellwig
2024-05-10  5:15   ` Sergey Senozhatsky
2024-05-10  7:40     ` Herbert Xu
2024-05-10  8:08       ` Sergey Senozhatsky [this message]
2024-05-10  8:12         ` Herbert Xu
2024-05-10  8:28           ` Sergey Senozhatsky
2024-05-10  8:30             ` Herbert Xu
2024-05-10  8:40               ` Sergey Senozhatsky

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=20240510080827.GB950946@google.com \
    --to=senozhatsky@chromium.org \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=hch@infradead.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minchan@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.