Messages in this thread |  | | Date | Fri, 25 Aug 2017 11:21:06 +0900 | From | Sergey Senozhatsky <> | Subject | Re: [PATCH] zram: add zstd to the supported algorithms list |
| |
On (08/25/17 02:09), 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). > > > > > > 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. > > > > a dictionaty pointer can be in `struct zstd_ctx'. > > Sorry I'm not super familiar with the crypto API. How would the user > initialize the dictionary in the `struct zstd_ctx'? I guess you could > either expose the struct in some header, or provide a function that > initializes it, but that isn't generic. Does the crypto library already > have a standard way to provide extra information?
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...
-ss
|  |