[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1663C9A3-7DAC-4A11-894C-C99E07BEDAD2@fb.com>
Date: Wed, 21 Mar 2018 19:56:10 +0000
From: Nick Terrell <terrelln@...com>
To: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
CC: Maninder Singh <maninder1.s@...sung.com>,
"herbert@...dor.apana.org.au" <herbert@...dor.apana.org.au>,
"davem@...emloft.net" <davem@...emloft.net>,
"minchan@...nel.org" <minchan@...nel.org>,
"ngupta@...are.org" <ngupta@...are.org>,
Kees Cook <keescook@...omium.org>,
"anton@...msg.org" <anton@...msg.org>,
"ccross@...roid.com" <ccross@...roid.com>,
"tony.luck@...el.com" <tony.luck@...el.com>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"colin.king@...onical.com" <colin.king@...onical.com>,
"linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"pankaj.m@...sung.com" <pankaj.m@...sung.com>,
"a.sahrawat@...sung.com" <a.sahrawat@...sung.com>,
"v.narang@...sung.com" <v.narang@...sung.com>,
Yann Collet <cyan@...com>
Subject: Re: [PATCH 0/1] cover-letter/lz4: Implement lz4 with dynamic offset
length.
On (03/21/18 10:10), Maninder Singh wrote:
> LZ4 specification defines 2 byte offset length for 64 KB data.
> But in case of ZRAM we compress data per page and in most of
> architecture PAGE_SIZE is 4KB. So we can decide offset length based
> on actual offset value. For this we can reserve 1 bit to decide offset
> length (1 byte or 2 byte). 2 byte required only if ofsset is greater than 127,
> else 1 byte is enough.
>
> With this new implementation new offset value can be at MAX 32 KB.
>
> Thus we can save more memory for compressed data.
>
> results checked with new implementation:-
>
> comression size for same input source
> (LZ4_DYN < LZO < LZ4)
>
> LZO
> =======
> orig_data_size: 78917632
> compr_data_size: 15894668
> mem_used_total: 17117184
>
> LZ4
> ========
> orig_data_size: 78917632
> compr_data_size: 16310717
> mem_used_total: 17592320
>
> LZ4_DYN
> =======
> orig_data_size: 78917632
> compr_data_size: 15520506
> mem_used_total: 16748544
This seems like a reasonable extension to the algorithm, and it looks like
LZ4_DYN is about a 5% improvement to compression ratio on your benchmark.
The biggest question I have is if it is worthwhile to maintain a separate
incompatible variant of LZ4 in the kernel without any upstream for a 5%
gain? If we do want to go forward with this, we should perform more
benchmarks.
I commented in the patch, but because the `dynOffset` variable isn't a
compile time static in LZ4_decompress_generic(), I suspect that the patch
causes a regression in decompression speed for both LZ4 and LZ4_DYN. You'll
need to re-run the benchmarks to first show that LZ4 before the patch
performs the same as LZ4 after the patch. Then re-run the LZ4 vs LZ4_DYN
benchmarks.
I would also like to see a benchmark in user-space (with the code), so we
can see the performance of LZ4 before and after the patch, as well as LZ4
vs LZ4_DYN without anything else going on. I expect the extra branches in
the decoding loop to have an impact on speed, and I would like to see how
big the impact is without noise.
CC-ing Yann Collet, the author of LZ4
Powered by blists - more mailing lists