0001 # SPDX-License-Identifier: GPL-2.0
0002 config ZRAM
0003 tristate "Compressed RAM block device support"
0004 depends on BLOCK && SYSFS && MMU
0005 depends on CRYPTO_LZO || CRYPTO_ZSTD || CRYPTO_LZ4 || CRYPTO_LZ4HC || CRYPTO_842
0006 select ZSMALLOC
0007 help
0008 Creates virtual block devices called /dev/zramX (X = 0, 1, ...).
0009 Pages written to these disks are compressed and stored in memory
0010 itself. These disks allow very fast I/O and compression provides
0011 good amounts of memory savings.
0012
0013 It has several use cases, for example: /tmp storage, use as swap
0014 disks and maybe many more.
0015
0016 See Documentation/admin-guide/blockdev/zram.rst for more information.
0017
0018 choice
0019 prompt "Default zram compressor"
0020 default ZRAM_DEF_COMP_LZORLE
0021 depends on ZRAM
0022
0023 config ZRAM_DEF_COMP_LZORLE
0024 bool "lzo-rle"
0025 depends on CRYPTO_LZO
0026
0027 config ZRAM_DEF_COMP_ZSTD
0028 bool "zstd"
0029 depends on CRYPTO_ZSTD
0030
0031 config ZRAM_DEF_COMP_LZ4
0032 bool "lz4"
0033 depends on CRYPTO_LZ4
0034
0035 config ZRAM_DEF_COMP_LZO
0036 bool "lzo"
0037 depends on CRYPTO_LZO
0038
0039 config ZRAM_DEF_COMP_LZ4HC
0040 bool "lz4hc"
0041 depends on CRYPTO_LZ4HC
0042
0043 config ZRAM_DEF_COMP_842
0044 bool "842"
0045 depends on CRYPTO_842
0046
0047 endchoice
0048
0049 config ZRAM_DEF_COMP
0050 string
0051 default "lzo-rle" if ZRAM_DEF_COMP_LZORLE
0052 default "zstd" if ZRAM_DEF_COMP_ZSTD
0053 default "lz4" if ZRAM_DEF_COMP_LZ4
0054 default "lzo" if ZRAM_DEF_COMP_LZO
0055 default "lz4hc" if ZRAM_DEF_COMP_LZ4HC
0056 default "842" if ZRAM_DEF_COMP_842
0057
0058 config ZRAM_WRITEBACK
0059 bool "Write back incompressible or idle page to backing device"
0060 depends on ZRAM
0061 help
0062 With incompressible page, there is no memory saving to keep it
0063 in memory. Instead, write it out to backing device.
0064 For this feature, admin should set up backing device via
0065 /sys/block/zramX/backing_dev.
0066
0067 With /sys/block/zramX/{idle,writeback}, application could ask
0068 idle page's writeback to the backing device to save in memory.
0069
0070 See Documentation/admin-guide/blockdev/zram.rst for more information.
0071
0072 config ZRAM_MEMORY_TRACKING
0073 bool "Track zRam block status"
0074 depends on ZRAM && DEBUG_FS
0075 help
0076 With this feature, admin can track the state of allocated blocks
0077 of zRAM. Admin could see the information via
0078 /sys/kernel/debug/zram/zramX/block_state.
0079
0080 See Documentation/admin-guide/blockdev/zram.rst for more information.