xref: /linux/drivers/block/zram/Kconfig (revision c60a4ef544464f03368ef399ccb8fc115ba9f070)
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_LZO
18	bool "lzo and lzo-rle compression support"
19	depends on ZRAM
20	select LZO_COMPRESS
21	select LZO_DECOMPRESS
22
23config ZRAM_BACKEND_LZ4
24	bool "lz4 compression support"
25	depends on ZRAM
26	select LZ4_COMPRESS
27	select LZ4_DECOMPRESS
28
29config ZRAM_BACKEND_LZ4HC
30	bool "lz4hc compression support"
31	depends on ZRAM
32	select LZ4HC_COMPRESS
33	select LZ4_DECOMPRESS
34
35choice
36	prompt "Default zram compressor"
37	default ZRAM_DEF_COMP_LZORLE
38	depends on ZRAM
39
40config ZRAM_DEF_COMP_LZORLE
41	bool "lzo-rle"
42	depends on ZRAM_BACKEND_LZO
43
44config ZRAM_DEF_COMP_LZO
45	bool "lzo"
46	depends on ZRAM_BACKEND_LZO
47
48config ZRAM_DEF_COMP_LZ4
49	bool "lz4"
50	depends on ZRAM_BACKEND_LZ4
51
52config ZRAM_DEF_COMP_LZ4HC
53	bool "lz4hc"
54	depends on ZRAM_BACKEND_LZ4HC
55
56endchoice
57
58config ZRAM_DEF_COMP
59	string
60	default "lzo-rle" if ZRAM_DEF_COMP_LZORLE
61	default "lzo" if ZRAM_DEF_COMP_LZO
62	default "lz4" if ZRAM_DEF_COMP_LZ4
63	default "lz4hc" if ZRAM_DEF_COMP_LZ4HC
64	default "unset-value"
65
66config ZRAM_WRITEBACK
67       bool "Write back incompressible or idle page to backing device"
68       depends on ZRAM
69       help
70	 This lets zram entries (incompressible or idle pages) be written
71	 back to a backing device, helping save memory.
72	 For this feature, admin should set up backing device via
73	 /sys/block/zramX/backing_dev.
74
75	 With /sys/block/zramX/{idle,writeback}, application could ask
76	 idle page's writeback to the backing device to save in memory.
77
78	 See Documentation/admin-guide/blockdev/zram.rst for more information.
79
80config ZRAM_TRACK_ENTRY_ACTIME
81	bool "Track access time of zram entries"
82	depends on ZRAM
83	help
84	  With this feature zram tracks access time of every stored
85	  entry (page), which can be used for a more fine grained IDLE
86	  pages writeback.
87
88config ZRAM_MEMORY_TRACKING
89	bool "Track zRam block status"
90	depends on ZRAM && DEBUG_FS
91	select ZRAM_TRACK_ENTRY_ACTIME
92	help
93	  With this feature, admin can track the state of allocated blocks
94	  of zRAM. Admin could see the information via
95	  /sys/kernel/debug/zram/zramX/block_state.
96
97	  See Documentation/admin-guide/blockdev/zram.rst for more information.
98
99config ZRAM_MULTI_COMP
100	bool "Enable multiple compression streams"
101	depends on ZRAM
102	help
103	  This will enable multi-compression streams, so that ZRAM can
104	  re-compress pages using a potentially slower but more effective
105	  compression algorithm. Note, that IDLE page recompression
106	  requires ZRAM_TRACK_ENTRY_ACTIME.
107