[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240503091823.3616962-1-senozhatsky@chromium.org>
Date: Fri, 3 May 2024 18:17:25 +0900
From: Sergey Senozhatsky <senozhatsky@...omium.org>
To: Andrew Morton <akpm@...ux-foundation.org>,
Minchan Kim <minchan@...nel.org>
Cc: linux-kernel@...r.kernel.org,
linux-block@...r.kernel.org,
Sergey Senozhatsky <senozhatsky@...omium.org>
Subject: [PATCH 00/14] zram: convert to custom comp API and allow algorithms configuration
This patch set moves zram from crypto API to a custom compression
API which allows us to tune and configure compression algorithms,
something that crypto API, unfortunately, doesn't support. Basically,
this seroes brings back the bits of comp "backend" code that we had
many years ago. This means that if we want zram to support new
compression algorithms we need to implement corresponding backends.
Currently, zram supports a pretty decent number of comp backends:
lzo, lzorle, lz4, lz4hc, deflate, zstd
At this point we handle 2 parameters: a compression level and
a pre-trained compression dictionary. Which seems like a good enough
start. The list will be extended in the future.
Examples:
- changes default compression level
echo "algo=zstd level=11" > /sys/block/zram0/comp_algorithm
- passes path to a pre-trained dictionary
echo "algo=zstd dict=/etc/dictionary" > /sys/block/zram0/comp_algorithm
TEST
====
using default zstd
/sys/block/zram0/mm_stat
1750315008 504602831 514256896 0 514256896 1 0 34204 34204
using zstd level=7 dict=/etc/dictionary
/sys/block/zram0/mm_stat
1750310912 432540606 441712640 0 441712640 1 0 34187 34187
Sergey Senozhatsky (14):
zram: move from crypto API to custom comp backends API
zram: add lzo and lzorle compression backends support
zram: add lz4 compression backend support
zram: add lz4hc compression backend support
zram: add zstd compression backend support
zram: pass estimated src size hint to zstd
zram: add zlib compression backend support
zram: check that backends array has at least one backend
zram: introduce zcomp_config structure
zram: extend comp_algorithm attr write handling
zram: support compression level comp config
zram: add support for dict comp config
zram: add dictionary support to zstd backend
Documentation/zram: add documentation for algorithm parameters
Documentation/admin-guide/blockdev/zram.rst | 38 ++++-
drivers/block/zram/Kconfig | 69 ++++++--
drivers/block/zram/Makefile | 7 +
drivers/block/zram/backend_deflate.c | 133 +++++++++++++++
drivers/block/zram/backend_deflate.h | 10 ++
drivers/block/zram/backend_lz4.c | 47 ++++++
drivers/block/zram/backend_lz4.h | 10 ++
drivers/block/zram/backend_lz4hc.c | 74 +++++++++
drivers/block/zram/backend_lz4hc.h | 10 ++
drivers/block/zram/backend_lzo.c | 44 +++++
drivers/block/zram/backend_lzo.h | 10 ++
drivers/block/zram/backend_lzorle.c | 44 +++++
drivers/block/zram/backend_lzorle.h | 10 ++
drivers/block/zram/backend_zstd.c | 174 ++++++++++++++++++++
drivers/block/zram/backend_zstd.h | 10 ++
drivers/block/zram/zcomp.c | 145 ++++++++--------
drivers/block/zram/zcomp.h | 38 ++++-
drivers/block/zram/zram_drv.c | 110 ++++++++++++-
drivers/block/zram/zram_drv.h | 1 +
19 files changed, 870 insertions(+), 114 deletions(-)
create mode 100644 drivers/block/zram/backend_deflate.c
create mode 100644 drivers/block/zram/backend_deflate.h
create mode 100644 drivers/block/zram/backend_lz4.c
create mode 100644 drivers/block/zram/backend_lz4.h
create mode 100644 drivers/block/zram/backend_lz4hc.c
create mode 100644 drivers/block/zram/backend_lz4hc.h
create mode 100644 drivers/block/zram/backend_lzo.c
create mode 100644 drivers/block/zram/backend_lzo.h
create mode 100644 drivers/block/zram/backend_lzorle.c
create mode 100644 drivers/block/zram/backend_lzorle.h
create mode 100644 drivers/block/zram/backend_zstd.c
create mode 100644 drivers/block/zram/backend_zstd.h
--
2.45.0.rc1.225.g2a3ae87e7f-goog
Powered by blists - more mailing lists