mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-05 09:16:44 +07:00
f21fb798fe
zram: Compressed RAM based block devices ---------------------------------------- The zram module creates RAM based block devices named /dev/zram<id> (<id> = 0, 1, ...). Pages written to these disks are compressed and stored in memory itself. These disks allow very fast I/O and compression provides good amounts of memory savings. Some of the usecases include /tmp storage, use as swap disks, various caches under /var and maybe many more :) Statistics for individual zram devices are exported through sysfs nodes at /sys/block/zram<id>/ This patch is to validate the zram functionality. Test interacts with block device /dev/zram<id> and sysfs nodes /sys/block/zram<id>/ zram.sh: sanity check of CONFIG_ZRAM and to run zram01 and zram02 tests zram01.sh: creates general purpose ram disks with different filesystems zram02.sh: creates block device for swap zram_lib.sh: create library with initialization/cleanup functions README: ZRAM introduction and Kconfig required. Makefile: To run zram tests zram test output ----------------- ./zram.sh -------------------- running zram tests -------------------- /dev/zram0 device file found: OK set max_comp_streams to zram device(s) /sys/block/zram0/max_comp_streams = '2' (1/1) zram max streams: OK test that we can set compression algorithm supported algs: [lzo] lz4 /sys/block/zram0/comp_algorithm = 'lzo' (1/1) zram set compression algorithm: OK set disk size to zram device(s) /sys/block/zram0/disksize = '2097152' (1/1) zram set disksizes: OK set memory limit to zram device(s) /sys/block/zram0/mem_limit = '2M' (1/1) zram set memory limit: OK make ext4 filesystem on /dev/zram0 zram mkfs.ext4: OK mount /dev/zram0 zram mount of zram device(s): OK fill zram0... zram0 can be filled with '1932' KB zram used 3M, zram disk sizes 2097152M zram compression ratio: 699050.66:1: OK zram cleanup zram01 : [PASS] /dev/zram0 device file found: OK set max_comp_streams to zram device(s) /sys/block/zram0/max_comp_streams = '2' (1/1) zram max streams: OK set disk size to zram device(s) /sys/block/zram0/disksize = '1048576' (1/1) zram set disksizes: OK set memory limit to zram device(s) /sys/block/zram0/mem_limit = '1M' (1/1) zram set memory limit: OK make swap with zram device(s) done with /dev/zram0 zram making zram mkswap and swapon: OK zram swapoff: OK zram cleanup zram02 : [PASS] CC: Shuah Khan <shuahkh@osg.samsung.com> CC: Tyler Baker <tyler.baker@linaro.org> CC: Milosz Wasilewski <milosz.wasilewski@linaro.org> CC: Alexey Kodanev <alexey.kodanev@oracle.com> Signed-off-by: Naresh Kamboju <naresh.kamboju@linaro.org> Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com> Reviewed-By: Tyler Baker <tyler.baker@linaro.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
41 lines
1.1 KiB
Plaintext
41 lines
1.1 KiB
Plaintext
zram: Compressed RAM based block devices
|
|
----------------------------------------
|
|
* Introduction
|
|
|
|
The zram module creates RAM based block devices named /dev/zram<id>
|
|
(<id> = 0, 1, ...). Pages written to these disks are compressed and stored
|
|
in memory itself. These disks allow very fast I/O and compression provides
|
|
good amounts of memory savings. Some of the usecases include /tmp storage,
|
|
use as swap disks, various caches under /var and maybe many more :)
|
|
|
|
Statistics for individual zram devices are exported through sysfs nodes at
|
|
/sys/block/zram<id>/
|
|
|
|
Kconfig required:
|
|
CONFIG_ZRAM=y
|
|
CONFIG_ZRAM_LZ4_COMPRESS=y
|
|
CONFIG_ZPOOL=y
|
|
CONFIG_ZSMALLOC=y
|
|
|
|
ZRAM Testcases
|
|
--------------
|
|
zram_lib.sh: create library with initialization/cleanup functions
|
|
zram.sh: For sanity check of CONFIG_ZRAM and to run zram01 and zram02
|
|
|
|
Two functional tests: zram01 and zram02:
|
|
zram01.sh: creates general purpose ram disks with ext4 filesystems
|
|
zram02.sh: creates block device for swap
|
|
|
|
Commands required for testing:
|
|
- bc
|
|
- dd
|
|
- free
|
|
- awk
|
|
- mkswap
|
|
- swapon
|
|
- swapoff
|
|
- mkfs/ mkfs.ext4
|
|
|
|
For more information please refer:
|
|
kernel-source-tree/Documentation/blockdev/zram.txt
|