@@ -90,7 +90,7 @@ controlled policy:
* max_pool_percent - The maximum percentage of memory that the compressed
pool can occupy.
-The default compressor is selected in ``CONFIG_ZSWAP_COMPRESSOR_DEFAULT``
+The default compressor is selected in ``CONFIG_COMPRESSOR_DEFAULT``
Kconfig option, but it can be overridden at boot time by setting the
``compressor`` attribute, e.g. ``zswap.compressor=lzo``.
It can also be changed at runtime using the sysfs "compressor"
@@ -91,7 +91,7 @@ CONFIG_BFQ_GROUP_IOSCHED=y
CONFIG_BINFMT_MISC=m
CONFIG_ZPOOL=y
CONFIG_ZSWAP=y
-CONFIG_ZSWAP_COMPRESSOR_DEFAULT_ZSTD=y
+CONFIG_COMPRESSOR_DEFAULT_ZSTD=y
CONFIG_ZBUD=y
CONFIG_Z3FOLD=y
CONFIG_ZSMALLOC=m
@@ -2,7 +2,7 @@
config ZRAM
tristate "Compressed RAM block device support"
depends on SWAP && SYSFS
- depends on CRYPTO_LZO || CRYPTO_ZSTD || CRYPTO_LZ4 || CRYPTO_LZ4HC || CRYPTO_842 || CRYPTO_DEFLATE
+ select CRYPTO
select ZSMALLOC
help
Creates virtual block devices called /dev/zramX (X = 0, 1, ...).
@@ -15,51 +15,6 @@ config ZRAM
See Documentation/admin-guide/blockdev/zram.rst for more information.
-choice
- prompt "Default zram compressor"
- default ZRAM_DEF_COMP_LZORLE
- depends on ZRAM
-
-config ZRAM_DEF_COMP_DEFLATE
- bool "Deflate"
- depends on CRYPTO_DEFLATE
-
-config ZRAM_DEF_COMP_LZORLE
- bool "lzo-rle"
- depends on CRYPTO_LZO
-
-config ZRAM_DEF_COMP_ZSTD
- bool "zstd"
- depends on CRYPTO_ZSTD
-
-config ZRAM_DEF_COMP_LZ4
- bool "lz4"
- depends on CRYPTO_LZ4
-
-config ZRAM_DEF_COMP_LZO
- bool "lzo"
- depends on CRYPTO_LZO
-
-config ZRAM_DEF_COMP_LZ4HC
- bool "lz4hc"
- depends on CRYPTO_LZ4HC
-
-config ZRAM_DEF_COMP_842
- bool "842"
- depends on CRYPTO_842
-
-endchoice
-
-config ZRAM_DEF_COMP
- string
- default "deflate" if ZRAM_DEF_COMP_DEFLATE
- default "lzo-rle" if ZRAM_DEF_COMP_LZORLE
- default "zstd" if ZRAM_DEF_COMP_ZSTD
- default "lz4" if ZRAM_DEF_COMP_LZ4
- default "lzo" if ZRAM_DEF_COMP_LZO
- default "lz4hc" if ZRAM_DEF_COMP_LZ4HC
- default "842" if ZRAM_DEF_COMP_842
-
config ZRAM_WRITEBACK
bool "Write back incompressible or idle page to backing device"
depends on ZRAM
@@ -41,7 +41,7 @@ static DEFINE_IDR(zram_index_idr);
static DEFINE_MUTEX(zram_index_mutex);
static int zram_major;
-static const char *default_compressor = CONFIG_ZRAM_DEF_COMP;
+static const char *default_compressor = CONFIG_COMPRESSOR_DEFAULT;
/* Module params (documentation at end) */
static unsigned int num_devices = 1;
@@ -9,9 +9,6 @@ menu "Memory Management options"
config ARCH_NO_SWAP
bool
-config ZPOOL
- bool
-
menuconfig SWAP
bool "Support for paging of anonymous memory (swap)"
depends on MMU && BLOCK && !ARCH_NO_SWAP
@@ -22,116 +19,118 @@ menuconfig SWAP
used to provide more virtual memory than the actual RAM present
in your computer. If unsure say Y.
-config ZSWAP
- bool "Compressed cache for swap pages"
- depends on SWAP
- select CRYPTO
- select ZPOOL
- help
- A lightweight compressed cache for swap pages. It takes
- pages that are in the process of being swapped out and attempts to
- compress them into a dynamically allocated RAM-based memory pool.
- This can result in a significant I/O reduction on swap device and,
- in the case where decompressing from RAM is faster than swap device
- reads, can also improve workload performance.
-
-config ZSWAP_DEFAULT_ON
- bool "Enable the compressed cache for swap pages by default"
- depends on ZSWAP
- help
- If selected, the compressed cache for swap pages will be enabled
- at boot, otherwise it will be disabled.
-
- The selection made here can be overridden by using the kernel
- command line 'zswap.enabled=' option.
-
-config ZSWAP_SHRINKER_DEFAULT_ON
- bool "Shrink the zswap pool on memory pressure"
- depends on ZSWAP
- default n
- help
- If selected, the zswap shrinker will be enabled, and the pages
- stored in the zswap pool will become available for reclaim (i.e
- written back to the backing swap device) on memory pressure.
-
- This means that zswap writeback could happen even if the pool is
- not yet full, or the cgroup zswap limit has not been reached,
- reducing the chance that cold pages will reside in the zswap pool
- and consume memory indefinitely.
+if SWAP
choice
- prompt "Default compressor"
- depends on ZSWAP
- default ZSWAP_COMPRESSOR_DEFAULT_LZORLE
+ prompt "Default page compressor algorithm"
+ depends on ZSWAP || ZRAM
+ default COMPRESSOR_DEFAULT_LZORLE
help
- Selects the default compression algorithm for the compressed cache
- for swap pages.
+ Selects the default compression algorithm for compressing pages.
For an overview what kind of performance can be expected from
a particular compression algorithm please refer to the benchmarks
available at the following LWN page:
https://lwn.net/Articles/751795/
- If in doubt, select 'LZO-RLE'.
+ If in doubt, select 'LZO-rle'.
- The selection made here can be overridden by using the kernel
- command line 'zswap.compressor=' option.
-
-config ZSWAP_COMPRESSOR_DEFAULT_DEFLATE
+config COMPRESSOR_DEFAULT_DEFLATE
bool "Deflate"
select CRYPTO_DEFLATE
help
Use the Deflate algorithm as the default compression algorithm.
-config ZSWAP_COMPRESSOR_DEFAULT_LZORLE
+config COMPRESSOR_DEFAULT_LZORLE
bool "LZO-RLE"
select CRYPTO_LZO
help
Use the LZO algorithm as the default compression algorithm.
-config ZSWAP_COMPRESSOR_DEFAULT_LZO
+config COMPRESSOR_DEFAULT_LZO
bool "LZO"
select CRYPTO_LZO
help
Use the LZO algorithm as the default compression algorithm.
-config ZSWAP_COMPRESSOR_DEFAULT_842
+config COMPRESSOR_DEFAULT_842
bool "842"
select CRYPTO_842
help
Use the 842 algorithm as the default compression algorithm.
-config ZSWAP_COMPRESSOR_DEFAULT_LZ4
+config COMPRESSOR_DEFAULT_LZ4
bool "LZ4"
select CRYPTO_LZ4
help
Use the LZ4 algorithm as the default compression algorithm.
-config ZSWAP_COMPRESSOR_DEFAULT_LZ4HC
+config COMPRESSOR_DEFAULT_LZ4HC
bool "LZ4HC"
select CRYPTO_LZ4HC
help
Use the LZ4HC algorithm as the default compression algorithm.
-config ZSWAP_COMPRESSOR_DEFAULT_ZSTD
- bool "zstd"
+config COMPRESSOR_DEFAULT_ZSTD
+ bool "ZSTD"
select CRYPTO_ZSTD
help
Use the zstd algorithm as the default compression algorithm.
+
endchoice
-config ZSWAP_COMPRESSOR_DEFAULT
+config COMPRESSOR_DEFAULT
string
- depends on ZSWAP
- default "deflate" if ZSWAP_COMPRESSOR_DEFAULT_DEFLATE
- default "lzo-rle" if ZSWAP_COMPRESSOR_DEFAULT_LZORLE
- default "lzo" if ZSWAP_COMPRESSOR_DEFAULT_LZO
- default "842" if ZSWAP_COMPRESSOR_DEFAULT_842
- default "lz4" if ZSWAP_COMPRESSOR_DEFAULT_LZ4
- default "lz4hc" if ZSWAP_COMPRESSOR_DEFAULT_LZ4HC
- default "zstd" if ZSWAP_COMPRESSOR_DEFAULT_ZSTD
+ depends on ZSWAP || ZRAM
+ default "deflate" if COMPRESSOR_DEFAULT_DEFLATE
+ default "lzo-rle" if COMPRESSOR_DEFAULT_LZORLE
+ default "lzo" if COMPRESSOR_DEFAULT_LZO
+ default "842" if COMPRESSOR_DEFAULT_842
+ default "lz4" if COMPRESSOR_DEFAULT_LZ4
+ default "lz4hc" if COMPRESSOR_DEFAULT_LZ4HC
+ default "zstd" if COMPRESSOR_DEFAULT_ZSTD
default ""
+config ZPOOL
+ bool
+
+config ZSWAP
+ bool "Compressed cache for swap pages"
+ depends on SWAP
+ select CRYPTO
+ select ZPOOL
+ help
+ A lightweight compressed cache for swap pages. It takes
+ pages that are in the process of being swapped out and attempts to
+ compress them into a dynamically allocated RAM-based memory pool.
+ This can result in a significant I/O reduction on swap device and,
+ in the case where decompressing from RAM is faster than swap device
+ reads, can also improve workload performance.
+
+config ZSWAP_DEFAULT_ON
+ bool "Enable the compressed cache for swap pages by default"
+ depends on ZSWAP
+ help
+ If selected, the compressed cache for swap pages will be enabled
+ at boot, otherwise it will be disabled.
+
+ The selection made here can be overridden by using the kernel
+ command line 'zswap.enabled=' option.
+
+config ZSWAP_SHRINKER_DEFAULT_ON
+ bool "Shrink the zswap pool on memory pressure"
+ depends on ZSWAP
+ default n
+ help
+ If selected, the zswap shrinker will be enabled, and the pages
+ stored in the zswap pool will become available for reclaim (i.e
+ written back to the backing swap device) on memory pressure.
+
+ This means that zswap writeback could happen even if the pool is
+ not yet full, or the cgroup zswap limit has not been reached,
+ reducing the chance that cold pages will reside in the zswap pool
+ and consume memory indefinitely.
+
choice
prompt "Default allocator"
depends on ZSWAP
@@ -231,6 +230,8 @@ config ZSMALLOC_CHAIN_SIZE
For more information, see zsmalloc documentation.
+endif #SWAP
+
menu "Slab allocator options"
config SLUB
@@ -96,7 +96,7 @@ static const struct kernel_param_ops zswap_enabled_param_ops = {
module_param_cb(enabled, &zswap_enabled_param_ops, &zswap_enabled, 0644);
/* Crypto compressor to use */
-static char *zswap_compressor = CONFIG_ZSWAP_COMPRESSOR_DEFAULT;
+static char *zswap_compressor = CONFIG_COMPRESSOR_DEFAULT;
static int zswap_compressor_param_set(const char *,
const struct kernel_param *);
static const struct kernel_param_ops zswap_compressor_param_ops = {
@@ -386,11 +386,11 @@ static struct zswap_pool *__zswap_pool_create_fallback(void)
has_comp = crypto_has_acomp(zswap_compressor, 0, 0);
if (!has_comp && strcmp(zswap_compressor,
- CONFIG_ZSWAP_COMPRESSOR_DEFAULT)) {
+ CONFIG_COMPRESSOR_DEFAULT)) {
pr_err("compressor %s not available, using default %s\n",
- zswap_compressor, CONFIG_ZSWAP_COMPRESSOR_DEFAULT);
+ zswap_compressor, CONFIG_COMPRESSOR_DEFAULT);
param_free_charp(&zswap_compressor);
- zswap_compressor = CONFIG_ZSWAP_COMPRESSOR_DEFAULT;
+ zswap_compressor = CONFIG_COMPRESSOR_DEFAULT;
has_comp = crypto_has_acomp(zswap_compressor, 0, 0);
}
if (!has_comp) {
Both zswap and zram could change compressor algorithm dynamically, it can be overridden at boot time by 'zswap.compressor=' for zswap, also there is a sysfs interface to change it, see /sys/block/zramX/comp_algorithm /sys/module/zswap/parameters/compressor So there is no need to maintain independence default compressor algorithm, unify the Kconfig to use lzo-rle as the default page compressor algorithm. Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> --- Documentation/admin-guide/mm/zswap.rst | 2 +- arch/loongarch/configs/loongson3_defconfig | 2 +- drivers/block/zram/Kconfig | 47 +------- drivers/block/zram/zram_drv.c | 2 +- mm/Kconfig | 131 +++++++++++---------- mm/zswap.c | 8 +- 6 files changed, 74 insertions(+), 118 deletions(-)