xref: /OK3568_Linux_fs/kernel/tools/testing/selftests/zram/README (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyunzram: Compressed RAM based block devices
2*4882a593Smuzhiyun----------------------------------------
3*4882a593Smuzhiyun* Introduction
4*4882a593Smuzhiyun
5*4882a593SmuzhiyunThe zram module creates RAM based block devices named /dev/zram<id>
6*4882a593Smuzhiyun(<id> = 0, 1, ...). Pages written to these disks are compressed and stored
7*4882a593Smuzhiyunin memory itself. These disks allow very fast I/O and compression provides
8*4882a593Smuzhiyungood amounts of memory savings. Some of the usecases include /tmp storage,
9*4882a593Smuzhiyunuse as swap disks, various caches under /var and maybe many more :)
10*4882a593Smuzhiyun
11*4882a593SmuzhiyunStatistics for individual zram devices are exported through sysfs nodes at
12*4882a593Smuzhiyun/sys/block/zram<id>/
13*4882a593Smuzhiyun
14*4882a593SmuzhiyunKconfig required:
15*4882a593SmuzhiyunCONFIG_ZRAM=y
16*4882a593SmuzhiyunCONFIG_CRYPTO_LZ4=y
17*4882a593SmuzhiyunCONFIG_ZPOOL=y
18*4882a593SmuzhiyunCONFIG_ZSMALLOC=y
19*4882a593Smuzhiyun
20*4882a593SmuzhiyunZRAM Testcases
21*4882a593Smuzhiyun--------------
22*4882a593Smuzhiyunzram_lib.sh: create library with initialization/cleanup functions
23*4882a593Smuzhiyunzram.sh: For sanity check of CONFIG_ZRAM and to run zram01 and zram02
24*4882a593Smuzhiyun
25*4882a593SmuzhiyunTwo functional tests: zram01 and zram02:
26*4882a593Smuzhiyunzram01.sh: creates general purpose ram disks with ext4 filesystems
27*4882a593Smuzhiyunzram02.sh: creates block device for swap
28*4882a593Smuzhiyun
29*4882a593SmuzhiyunCommands required for testing:
30*4882a593Smuzhiyun - bc
31*4882a593Smuzhiyun - dd
32*4882a593Smuzhiyun - free
33*4882a593Smuzhiyun - awk
34*4882a593Smuzhiyun - mkswap
35*4882a593Smuzhiyun - swapon
36*4882a593Smuzhiyun - swapoff
37*4882a593Smuzhiyun - mkfs/ mkfs.ext4
38*4882a593Smuzhiyun
39*4882a593SmuzhiyunFor more information please refer:
40*4882a593Smuzhiyunkernel-source-tree/Documentation/admin-guide/blockdev/zram.rst
41