Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
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 depends on ZRAM
98 default "lzo-rle" if ZRAM_DEF_COMP_LZORLE
99 default "lzo" if ZRAM_DEF_COMP_LZO
100 default "lz4" if ZRAM_DEF_COMP_LZ4
101 default "lz4hc" if ZRAM_DEF_COMP_LZ4HC
102 default "zstd" if ZRAM_DEF_COMP_ZSTD
103 default "deflate" if ZRAM_DEF_COMP_DEFLATE
104 default "842" if ZRAM_DEF_COMP_842
105 default "unset-value"
106
107config ZRAM_WRITEBACK
108 bool "Write back incompressible or idle page to backing device"
109 depends on ZRAM
110 help
111 This lets zram entries (incompressible or idle pages) be written
112 back to a backing device, helping save memory.
113 For this feature, admin should set up backing device via
114 /sys/block/zramX/backing_dev.
115
116 With /sys/block/zramX/{idle,writeback}, application could ask
117 idle page's writeback to the backing device to save in memory.
118
119 See Documentation/admin-guide/blockdev/zram.rst for more information.
120
121config ZRAM_TRACK_ENTRY_ACTIME
122 bool "Track access time of zram entries"
123 depends on ZRAM
124 help
125 With this feature zram tracks access time of every stored
126 entry (page), which can be used for a more fine grained IDLE
127 pages writeback.
128
129config ZRAM_MEMORY_TRACKING
130 bool "Track zRam block status"
131 depends on ZRAM && DEBUG_FS
132 select ZRAM_TRACK_ENTRY_ACTIME
133 help
134 With this feature, admin can track the state of allocated blocks
135 of zRAM. Admin could see the information via
136 /sys/kernel/debug/zram/zramX/block_state.
137
138 See Documentation/admin-guide/blockdev/zram.rst for more information.
139
140config ZRAM_MULTI_COMP
141 bool "Enable multiple compression streams"
142 depends on ZRAM
143 help
144 This will enable multi-compression streams, so that ZRAM can
145 re-compress pages using a potentially slower but more effective
146 compression algorithm. Note, that IDLE page recompression
147 requires ZRAM_TRACK_ENTRY_ACTIME.