From: Minchan Kim <minchan@kernel.org>
To: Nick Terrell <terrelln@fb.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>,
"sergey.senozhatsky.work@gmail.com"
<sergey.senozhatsky.work@gmail.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Yann Collet <cyan@fb.com>
Subject: Re: [PATCH] zram: add zstd to the supported algorithms list
Date: Mon, 28 Aug 2017 15:52:38 +0900 [thread overview]
Message-ID: <20170828065238.GA6309@blaptop> (raw)
In-Reply-To: <315465C2-671F-4165-970E-B74ACFB9398D@fb.com>
Hi Nick,
On Fri, Aug 25, 2017 at 07:31:14PM +0000, Nick Terrell wrote:
> On 8/24/17, 10:19 PM, "Minchan Kim" <minchan@kernel.org> wrote:
> > On Fri, Aug 25, 2017 at 01:35:35AM +0000, Nick Terrell wrote:
> [..]
> > > I think using dictionaries in zram could be very interesting. We could for
> > > example, take a random sample of the RAM and use that as the dictionary
> > > for compression. E.g. take 32 512B samples from RAM and build a 16 KB
> > > dictionary (sizes may vary).
> >
> > For static option, could we create the dictionary with data in zram
> > and dump the dictionary into file. And then, rebuiling zram or kernel
> > includes the dictionary into images.
> >
> > For it, we would need some knob like
> >
> > cat /sys/block/zram/zstd_dict > dict.data
> >
> > CONFIG_ZSTD_DICT_DIR=
> > CONFIG_ZSTD_DICT_FILE=
>
> My guess is that a static dictionary won't cut it, since different
> workloads will have drastically different RAM contents, so we won't be able
> to construct a single dictionary that works for them all. I'd love to be
> proven wrong though.
zRAM is popular for system swap in embedded world. In mobile phone,
there would be different workloads as you said but other scenario
like refrigerator, TV and so will have very specific scenario
so it would be a great to have.
>
> > For dynamic option, could we make the dictionary with data
> > in zram dynamically? So, upcoming pages will use the newly
> > created dictionary but old compressed pages will use own dictionary.
>
> Yeah thats totally possible on the compression side, we would just need to
> save which pages were compressed with which dictionary somewhere.
Great. We have zram->table for object based and zspage for pages unit
so I expect it wouldn't be hard to implement.
>
> > I'm not sure it's possible, anyway, if predefined dict can help
> > comp ratio a lot in 4K data, I really love the feature and will support
> > to have it. ;)
> >
> > >
> > > I'm not sure how you would pass a dictionary into the crypto compression
> > > API, but I'm sure we can make something work if dictionary compression
> > > proves to be beneficial enough.
> >
> > Yes, it would be better to integrate the feature crypto but Please, don't tie to
> > crypto API. If it's hard to support with current cypto API in short time,
> > I really want to support it with zcomp_zstd.c.
> >
> > Please look at old zcomp model.
> > http://elixir.free-electrons.com/linux/v4.7/source/drivers/block/zram/zcomp_lz4.c
>
> Thanks for the link, we could definitely make zcomp work with dictionaries.
>
> > > What data have you, or anyone, used for benchmarking compression ratio and
> > > speed for RAM? Since it is such a specialized application, the standard
> > > compression benchmarks aren't very applicable.
> >
> > I have used my image dumped from desktop swap device.
> > Of course, it doesn't cover all of cases in the world but it would be better
> > to use IO benchmark buffer, IMHO. :)
>
> Since adding dictionary support won't be quite as easy as adding zstd
> support, I think the first step is building a set of benchmarks that
> represent some common real world scenarios. We can easily test different
> dictionary construction algorithms in userspace, and determine if the work
> will pay off for some workloads. I'll collect some RAM samples from my
> device and run some preliminary tests.
Sweet. I am looking forward to seeing your result.
Thanks!
next prev parent reply other threads:[~2017-08-28 6:52 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
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 [this message]
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=20170828065238.GA6309@blaptop \
--to=minchan@kernel.org \
--cc=cyan@fb.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sergey.senozhatsky.work@gmail.com \
--cc=terrelln@fb.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