xref: /linux/tools/testing/selftests/zram/README (revision 0898782247ae533d1f4e47a06bc5d4870931b284)
1f21fb798SNaresh Kambojuzram: Compressed RAM based block devices
2f21fb798SNaresh Kamboju----------------------------------------
3f21fb798SNaresh Kamboju* Introduction
4f21fb798SNaresh Kamboju
5f21fb798SNaresh KambojuThe zram module creates RAM based block devices named /dev/zram<id>
6f21fb798SNaresh Kamboju(<id> = 0, 1, ...). Pages written to these disks are compressed and stored
7f21fb798SNaresh Kambojuin memory itself. These disks allow very fast I/O and compression provides
8f21fb798SNaresh Kambojugood amounts of memory savings. Some of the usecases include /tmp storage,
9f21fb798SNaresh Kambojuuse as swap disks, various caches under /var and maybe many more :)
10f21fb798SNaresh Kamboju
11f21fb798SNaresh KambojuStatistics for individual zram devices are exported through sysfs nodes at
12f21fb798SNaresh Kamboju/sys/block/zram<id>/
13f21fb798SNaresh Kamboju
14f21fb798SNaresh KambojuKconfig required:
15f21fb798SNaresh KambojuCONFIG_ZRAM=y
160ad46becSFabian FrederickCONFIG_CRYPTO_LZ4=y
17f21fb798SNaresh KambojuCONFIG_ZPOOL=y
18f21fb798SNaresh KambojuCONFIG_ZSMALLOC=y
19f21fb798SNaresh Kamboju
20f21fb798SNaresh KambojuZRAM Testcases
21f21fb798SNaresh Kamboju--------------
22f21fb798SNaresh Kambojuzram_lib.sh: create library with initialization/cleanup functions
23f21fb798SNaresh Kambojuzram.sh: For sanity check of CONFIG_ZRAM and to run zram01 and zram02
24f21fb798SNaresh Kamboju
25f21fb798SNaresh KambojuTwo functional tests: zram01 and zram02:
26f21fb798SNaresh Kambojuzram01.sh: creates general purpose ram disks with ext4 filesystems
27f21fb798SNaresh Kambojuzram02.sh: creates block device for swap
28f21fb798SNaresh Kamboju
29f21fb798SNaresh KambojuCommands required for testing:
30f21fb798SNaresh Kamboju - bc
31f21fb798SNaresh Kamboju - dd
32f21fb798SNaresh Kamboju - free
33f21fb798SNaresh Kamboju - awk
34f21fb798SNaresh Kamboju - mkswap
35f21fb798SNaresh Kamboju - swapon
36f21fb798SNaresh Kamboju - swapoff
37f21fb798SNaresh Kamboju - mkfs/ mkfs.ext4
38f21fb798SNaresh Kamboju
39f21fb798SNaresh KambojuFor more information please refer:
40*e7751617SMauro Carvalho Chehabkernel-source-tree/Documentation/admin-guide/blockdev/zram.rst
41