summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/zram/zram_lib.sh
diff options
context:
space:
mode:
authorYang Xu <xuyang2018.jy@fujitsu.com>2022-01-27 17:11:36 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-02-23 11:56:39 +0100
commit75fc3ca360c2959e7b23fa4acdc0809f41770c90 (patch)
treec319ffb0f6d520b0bcc3d0363bf58728306fea19 /tools/testing/selftests/zram/zram_lib.sh
parent70e0d201013b894c4f5d3744539f0883ab2aeca9 (diff)
selftests/zram01.sh: Fix compression ratio calculation
[ Upstream commit d18da7ec3719559d6e74937266d0416e6c7e0b31 ] zram01 uses `free -m` to measure zram memory usage. The results are no sense because they are polluted by all running processes on the system. We Should only calculate the free memory delta for the current process. So use the third field of /sys/block/zram<id>/mm_stat to measure memory usage instead. The file is available since kernel 4.1. orig_data_size(first): uncompressed size of data stored in this disk. compr_data_size(second): compressed size of data stored in this disk mem_used_total(third): the amount of memory allocated for this disk Also remove useless zram cleanup call in zram_fill_fs and so we don't need to cleanup zram twice if fails. Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools/testing/selftests/zram/zram_lib.sh')
0 files changed, 0 insertions, 0 deletions