xref: /linux/drivers/block/zram/Kconfig (revision ae22a94997b8a03dcb3c922857c203246711f9d4)
1# SPDX-License-Identifier: GPL-2.0
2config ZRAM
3	tristate "Compressed RAM block device support"
4	depends on BLOCK && SYSFS && MMU
5	depends on CRYPTO_LZO || CRYPTO_ZSTD || CRYPTO_LZ4 || CRYPTO_LZ4HC || CRYPTO_842
6	select ZSMALLOC
7	help
8	  Creates virtual block devices called /dev/zramX (X = 0, 1, ...).
9	  Pages written to these disks are compressed and stored in memory
10	  itself. These disks allow very fast I/O and compression provides
11	  good amounts of memory savings.
12
13	  It has several use cases, for example: /tmp storage, use as swap
14	  disks and maybe many more.
15
16	  See Documentation/admin-guide/blockdev/zram.rst for more information.
17
18choice
19	prompt "Default zram compressor"
20	default ZRAM_DEF_COMP_LZORLE
21	depends on ZRAM
22
23config ZRAM_DEF_COMP_LZORLE
24	bool "lzo-rle"
25	depends on CRYPTO_LZO
26
27config ZRAM_DEF_COMP_ZSTD
28	bool "zstd"
29	depends on CRYPTO_ZSTD
30
31config ZRAM_DEF_COMP_LZ4
32	bool "lz4"
33	depends on CRYPTO_LZ4
34
35config ZRAM_DEF_COMP_LZO
36	bool "lzo"
37	depends on CRYPTO_LZO
38
39config ZRAM_DEF_COMP_LZ4HC
40	bool "lz4hc"
41	depends on CRYPTO_LZ4HC
42
43config ZRAM_DEF_COMP_842
44	bool "842"
45	depends on CRYPTO_842
46
47endchoice
48
49config ZRAM_DEF_COMP
50	string
51	default "lzo-rle" if ZRAM_DEF_COMP_LZORLE
52	default "zstd" if ZRAM_DEF_COMP_ZSTD
53	default "lz4" if ZRAM_DEF_COMP_LZ4
54	default "lzo" if ZRAM_DEF_COMP_LZO
55	default "lz4hc" if ZRAM_DEF_COMP_LZ4HC
56	default "842" if ZRAM_DEF_COMP_842
57
58config ZRAM_WRITEBACK
59       bool "Write back incompressible or idle page to backing device"
60       depends on ZRAM
61       help
62	 This lets zram entries (incompressible or idle pages) be written
63	 back to a backing device, helping save memory.
64	 For this feature, admin should set up backing device via
65	 /sys/block/zramX/backing_dev.
66
67	 With /sys/block/zramX/{idle,writeback}, application could ask
68	 idle page's writeback to the backing device to save in memory.
69
70	 See Documentation/admin-guide/blockdev/zram.rst for more information.
71
72config ZRAM_TRACK_ENTRY_ACTIME
73	bool "Track access time of zram entries"
74	depends on ZRAM
75	help
76	  With this feature zram tracks access time of every stored
77	  entry (page), which can be used for a more fine grained IDLE
78	  pages writeback.
79
80config ZRAM_MEMORY_TRACKING
81	bool "Track zRam block status"
82	depends on ZRAM && DEBUG_FS
83	select ZRAM_TRACK_ENTRY_ACTIME
84	help
85	  With this feature, admin can track the state of allocated blocks
86	  of zRAM. Admin could see the information via
87	  /sys/kernel/debug/zram/zramX/block_state.
88
89	  See Documentation/admin-guide/blockdev/zram.rst for more information.
90
91config ZRAM_MULTI_COMP
92	bool "Enable multiple compression streams"
93	depends on ZRAM
94	help
95	  This will enable multi-compression streams, so that ZRAM can
96	  re-compress pages using a potentially slower but more effective
97	  compression algorithm. Note, that IDLE page recompression
98	  requires ZRAM_TRACK_ENTRY_ACTIME.
99