[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240508074223.652784-20-senozhatsky@chromium.org>
Date: Wed, 8 May 2024 16:42:12 +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: [PATCHv3 19/19] Documentation/zram: add documentation for algorithm parameters
Document brief description of compression algorithms' parameters:
compression level and pre-trained dictionary.
Signed-off-by: Sergey Senozhatsky <senozhatsky@...omium.org>
---
Documentation/admin-guide/blockdev/zram.rst | 38 ++++++++++++++++-----
1 file changed, 29 insertions(+), 9 deletions(-)
diff --git a/Documentation/admin-guide/blockdev/zram.rst b/Documentation/admin-guide/blockdev/zram.rst
index 091e8bb38887..58d79f9099e3 100644
--- a/Documentation/admin-guide/blockdev/zram.rst
+++ b/Documentation/admin-guide/blockdev/zram.rst
@@ -102,15 +102,26 @@ Examples::
#select lzo compression algorithm
echo lzo > /sys/block/zram0/comp_algorithm
-For the time being, the `comp_algorithm` content does not necessarily
-show every compression algorithm supported by the kernel. We keep this
-list primarily to simplify device configuration and one can configure
-a new device with a compression algorithm that is not listed in
-`comp_algorithm`. The thing is that, internally, ZRAM uses Crypto API
-and, if some of the algorithms were built as modules, it's impossible
-to list all of them using, for instance, /proc/crypto or any other
-method. This, however, has an advantage of permitting the usage of
-custom crypto compression modules (implementing S/W or H/W compression).
+For the time being, the `comp_algorithm` content shows only compression
+algorithms that are supported by zram.
+
+It is also possible to pass algorithm specific configuration parameters::
+
+ #set compression level to 8
+ echo "zstd level=8" > /sys/block/zram0/comp_algorithm
+
+Note that `comp_algorithm` also supports `algo=name` format::
+
+ #set compression level to 8
+ echo "algo=zstd level=8" > /sys/block/zram0/comp_algorithm
+
+Certain compression algorithms support pre-trained dictionaries, which
+significantly change algorithms' characteristics. In order to configure
+compression algorithm to use external pre-trained dictionary, pass full
+path to the dictionary along with other parameters::
+
+ #pass path to pre-trained dictionary
+ echo "algo=zstd dict=/etc/dictioary" > /sys/block/zram0/comp_algorithm
4) Set Disksize
===============
@@ -442,6 +453,15 @@ configuration:::
#select deflate recompression algorithm, priority 2
echo "algo=deflate priority=2" > /sys/block/zramX/recomp_algorithm
+The `recomp_algorithm` also supports algorithm configuration parameters, e.g.
+compression level and pre-trained dircionary::
+
+ #pass compression level
+ echo "algo=zstd level=8" > /sys/block/zramX/recomp_algorithm
+
+ #pass path to pre-trained dictionary
+ echo "algo=zstd dict=/etc/dictioary" > /sys/block/zramX/recomp_algorithm
+
Another device attribute that CONFIG_ZRAM_MULTI_COMP enables is recompress,
which controls recompression.
--
2.45.0.rc1.225.g2a3ae87e7f-goog
Powered by blists - more mailing lists