xref: /linux/drivers/block/zram/Kconfig (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
1# SPDX-License-Identifier: GPL-2.0
2config ZRAM
3	tristate "Compressed RAM block device support"
4	depends on BLOCK && SYSFS && MMU
5	select ZSMALLOC
6	help
7	  Creates virtual block devices called /dev/zramX (X = 0, 1, ...).
8	  Pages written to these disks are compressed and stored in memory
9	  itself. These disks allow very fast I/O and compression provides
10	  good amounts of memory savings.
11
12	  It has several use cases, for example: /tmp storage, use as swap
13	  disks and maybe many more.
14
15	  See Documentation/admin-guide/blockdev/zram.rst for more information.
16
17config ZRAM_BACKEND_LZ4
18	bool "lz4 compression support"
19	depends on ZRAM
20	select LZ4_COMPRESS
21	select LZ4_DECOMPRESS
22
23config ZRAM_BACKEND_LZ4HC
24	bool "lz4hc compression support"
25	depends on ZRAM
26	select LZ4HC_COMPRESS
27	select LZ4_DECOMPRESS
28
29config ZRAM_BACKEND_ZSTD
30	bool "zstd compression support"
31	depends on ZRAM
32	select ZSTD_COMPRESS
33	select ZSTD_DECOMPRESS
34
35config ZRAM_BACKEND_DEFLATE
36	bool "deflate compression support"
37	depends on ZRAM
38	select ZLIB_DEFLATE
39	select ZLIB_INFLATE
40
41config ZRAM_BACKEND_842
42	bool "842 compression support"
43	depends on ZRAM
44	select 842_COMPRESS
45	select 842_DECOMPRESS
46
47config ZRAM_BACKEND_FORCE_LZO
48	depends on ZRAM
49	def_bool !ZRAM_BACKEND_LZ4 && !ZRAM_BACKEND_LZ4HC && \
50		!ZRAM_BACKEND_ZSTD && !ZRAM_BACKEND_DEFLATE && \
51		!ZRAM_BACKEND_842
52
53config ZRAM_BACKEND_LZO
54	bool "lzo and lzo-rle compression support" if !ZRAM_BACKEND_FORCE_LZO
55	depends on ZRAM
56	default ZRAM_BACKEND_FORCE_LZO
57	select LZO_COMPRESS
58	select LZO_DECOMPRESS
59
60choice
61	prompt "Default zram compressor"
62	default ZRAM_DEF_COMP_LZORLE
63	depends on ZRAM
64
65config ZRAM_DEF_COMP_LZORLE
66	bool "lzo-rle"
67	depends on ZRAM_BACKEND_LZO
68
69config ZRAM_DEF_COMP_LZO
70	bool "lzo"
71	depends on ZRAM_BACKEND_LZO
72
73config ZRAM_DEF_COMP_LZ4
74	bool "lz4"
75	depends on ZRAM_BACKEND_LZ4
76
77config ZRAM_DEF_COMP_LZ4HC
78	bool "lz4hc"
79	depends on ZRAM_BACKEND_LZ4HC
80
81config ZRAM_DEF_COMP_ZSTD
82	bool "zstd"
83	depends on ZRAM_BACKEND_ZSTD
84
85config ZRAM_DEF_COMP_DEFLATE
86	bool "deflate"
87	depends on ZRAM_BACKEND_DEFLATE
88
89config ZRAM_DEF_COMP_842
90	bool "842"
91	depends on ZRAM_BACKEND_842
92
93endchoice
94
95config ZRAM_DEF_COMP
96	string
97	default "lzo-rle" if ZRAM_DEF_COMP_LZORLE
98	default "lzo" if ZRAM_DEF_COMP_LZO
99	default "lz4" if ZRAM_DEF_COMP_LZ4
100	default "lz4hc" if ZRAM_DEF_COMP_LZ4HC
101	default "zstd" if ZRAM_DEF_COMP_ZSTD
102	default "deflate" if ZRAM_DEF_COMP_DEFLATE
103	default "842" if ZRAM_DEF_COMP_842
104	default "unset-value"
105
106config ZRAM_WRITEBACK
107       bool "Write back incompressible or idle page to backing device"
108       depends on ZRAM
109       help
110	 This lets zram entries (incompressible or idle pages) be written
111	 back to a backing device, helping save memory.
112	 For this feature, admin should set up backing device via
113	 /sys/block/zramX/backing_dev.
114
115	 With /sys/block/zramX/{idle,writeback}, application could ask
116	 idle page's writeback to the backing device to save in memory.
117
118	 See Documentation/admin-guide/blockdev/zram.rst for more information.
119
120config ZRAM_TRACK_ENTRY_ACTIME
121	bool "Track access time of zram entries"
122	depends on ZRAM
123	help
124	  With this feature zram tracks access time of every stored
125	  entry (page), which can be used for a more fine grained IDLE
126	  pages writeback.
127
128config ZRAM_MEMORY_TRACKING
129	bool "Track zRam block status"
130	depends on ZRAM && DEBUG_FS
131	select ZRAM_TRACK_ENTRY_ACTIME
132	help
133	  With this feature, admin can track the state of allocated blocks
134	  of zRAM. Admin could see the information via
135	  /sys/kernel/debug/zram/zramX/block_state.
136
137	  See Documentation/admin-guide/blockdev/zram.rst for more information.
138
139config ZRAM_MULTI_COMP
140	bool "Enable multiple compression streams"
141	depends on ZRAM
142	help
143	  This will enable multi-compression streams, so that ZRAM can
144	  re-compress pages using a potentially slower but more effective
145	  compression algorithm. Note, that IDLE page recompression
146	  requires ZRAM_TRACK_ENTRY_ACTIME.
147