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