Sergey Senozhatsky
1e673c8cf7
zram: add dictionary support to lz4hc
...
Support pre-trained dictionary param. Just like lz4, lz4hc doesn't
mandate specific format of the dictionary and zstd --train can be used to
train a dictionary for lz4, according to [1].
TEST
====
*** lz4hc
/sys/block/zram0/mm_stat
1750638592 608954620 621031424 0 621031424 1 0 34288 34288
*** lz4hc dict=/etc/lz4-dict-amd64
/sys/block/zram0/mm_stat
1750671360 505068582 514994176 0 514994176 1 0 34278 34278
[1] https://github.com/lz4/lz4/issues/557
Link: https://lkml.kernel.org/r/20240902105656.1383858-22-senozhatsky@chromium.org
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org >
Cc: Minchan Kim <minchan@kernel.org >
Cc: Nick Terrell <terrelln@fb.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-09 16:39:11 -07:00
Sergey Senozhatsky
b8f03cb703
zram: move immutable comp params away from per-CPU context
...
Immutable params never change once comp has been allocated and setup, so
we don't need to store multiple copies of them in each per-CPU backend
context. Move those to per-comp zcomp_params and pass it to backends
callbacks for requests execution. Basically, this means parameters
sharing between different contexts.
Also introduce two new backends callbacks: setup_params() and
release_params(). First, we need to validate params in a driver-specific
way; second, driver may want to allocate its specific representation of
the params which is needed to execute requests.
Link: https://lkml.kernel.org/r/20240902105656.1383858-20-senozhatsky@chromium.org
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org >
Cc: Minchan Kim <minchan@kernel.org >
Cc: Nick Terrell <terrelln@fb.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-09 16:39:10 -07:00
Sergey Senozhatsky
6a81bdfeb3
zram: introduce zcomp_ctx structure
...
Keep run-time driver data (scratch buffers, etc.) in zcomp_ctx structure.
This structure is allocated per-CPU because drivers (backends) need to
modify its content during requests execution.
We will split mutable and immutable driver data, this is a preparation
path.
Link: https://lkml.kernel.org/r/20240902105656.1383858-19-senozhatsky@chromium.org
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org >
Cc: Minchan Kim <minchan@kernel.org >
Cc: Nick Terrell <terrelln@fb.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-09 16:39:10 -07:00
Sergey Senozhatsky
52c7b4e2ba
zram: introduce zcomp_req structure
...
Encapsulate compression/decompression data in zcomp_req structure.
Link: https://lkml.kernel.org/r/20240902105656.1383858-18-senozhatsky@chromium.org
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org >
Cc: Minchan Kim <minchan@kernel.org >
Cc: Nick Terrell <terrelln@fb.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-09 16:39:10 -07:00
Sergey Senozhatsky
f2bac7ad18
zram: introduce zcomp_params structure
...
We will store a per-algorithm parameters there (compression level,
dictionary, dictionary size, etc.).
Link: https://lkml.kernel.org/r/20240902105656.1383858-14-senozhatsky@chromium.org
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org >
Cc: Minchan Kim <minchan@kernel.org >
Cc: Nick Terrell <terrelln@fb.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-09 16:39:09 -07:00
Sergey Senozhatsky
c60a4ef544
zram: add lz4hc compression backend support
...
Add s/w lz4hc compression support.
Link: https://lkml.kernel.org/r/20240902105656.1383858-8-senozhatsky@chromium.org
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org >
Cc: Minchan Kim <minchan@kernel.org >
Cc: Nick Terrell <terrelln@fb.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-09 16:39:07 -07:00