All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Terrell <terrelln@fb.com>
To: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"minchan@kernel.org" <minchan@kernel.org>,
	Yann Collet <cyan@fb.com>
Subject: Re: [PATCH] zram: add zstd to the supported algorithms list
Date: Fri, 25 Aug 2017 02:46:04 +0000	[thread overview]
Message-ID: <69F9B64F-B138-4D8B-9167-9B91855CFFA9@fb.com> (raw)
In-Reply-To: <20170825022106.GC743@jagdpanzerIV.localdomain>

On 8/24/17, 7:21 PM, "Sergey Senozhatsky" <sergey.senozhatsky.work@gmail.com> wrote:
> not really familiar either... I was thinking about having "zstd" and
> "zstd_dict" crypto_alg structs - one would be !dict, the other one would
> allocate dict and pass it to compress/decompress zstd callbacks. "zstd"
> vecrsion would invoke zstd_params() passing zeros as compress and dict
> sizes to ZSTD_getParams(), while "zstd_dict" would invoke, lets say,
> zstd_params_dict() passing PAGE_SIZE-s. hm... (0, PAGE_SIZE)?  to
> ZSTD_getParams(). just a rough idea...

The way zstd dictionaries work is the user provides some data which gets
"prepended" to the data that is about to be compressed, without actually
writing it to output. That way zstd can find matches in the dictionary and
represent them for "free". That means the user has to pass the same data to
both the compressor and decompressor.

We could build a dictionary, say every 20 minutes, by sampling 512 B chunks
of the RAM and constructing a 16 KB dictionary. Then recompress all the
compressed RAM with the new dictionary. This is just a simple example of a
dictionary construction algorithm. You could imagine grouping pages by
application, and building a dictionary per application, since those pages
would likely be more similar.

Regarding the crypto API, I think it would be possible to experiment by
creating functions like
`zstd_comp_add_dictionary(void *ctx, void *data, size_t size)'
and `zstd_decomp_add_dictionary(void *ctx, void *data, size_t size)'
in the crypto zstd implementation and declare them in `zcomp.c'. If the
experiments prove that using zstd dictionaries (or LZ4 dictionaries) is
worthwhile, then we can figure out how we can make it work for real.

  reply	other threads:[~2017-08-25  2:46 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <<20170824014936.4738-1-sergey.senozhatsky@gmail.com>
2017-08-24 21:33 ` [PATCH] zram: add zstd to the supported algorithms list Nick Terrell
2017-08-25  0:49   ` Joonsoo Kim
2017-08-25  1:35     ` Nick Terrell
2017-08-25  1:53       ` Sergey Senozhatsky
2017-08-25  2:09         ` Nick Terrell
2017-08-25  2:21           ` Sergey Senozhatsky
2017-08-25  2:46             ` Nick Terrell [this message]
2017-08-25  5:26               ` Sergey Senozhatsky
2017-08-25  2:02       ` Joonsoo Kim
2017-08-25  5:19       ` Minchan Kim
2017-08-25 19:31         ` Nick Terrell
2017-08-28  6:52           ` Minchan Kim
2017-08-25  0:51   ` Sergey Senozhatsky
2017-08-24  1:49 Sergey Senozhatsky
2017-08-24  4:30 ` Minchan Kim
2017-08-24 14:04   ` Sergey Senozhatsky
2017-08-25  4:50     ` Minchan Kim
2017-08-25  5:06       ` Sergey Senozhatsky
2017-08-25  5:27         ` Sergey Senozhatsky
2017-08-25  5:36         ` Minchan Kim
2017-08-25  7:45           ` Sergey Senozhatsky
2017-08-25  8:08             ` Adam Borowski
2017-08-25 18:55       ` Nick Terrell

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=69F9B64F-B138-4D8B-9167-9B91855CFFA9@fb.com \
    --to=terrelln@fb.com \
    --cc=cyan@fb.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minchan@kernel.org \
    --cc=sergey.senozhatsky.work@gmail.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 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.