Skip to content

Fix compression ratio calculation in zram01

Martin Doucha ltp 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest1 patch 0 repliesNew
  2. v11 patch 0 repliesSuperseded

Changes in v2 from the cover letter

- TINFO about amount of data written to zram device changed to TPASS

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1Fix compression ratio calculation in zram01testcases/kernel/device-drivers/zram/zram01.sh+17 -211 reply
1/1Fix compression ratio calculation in zram01+0 -01 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [LTP] [PATCH v2 0/1] Fix compression ratio calculation in zram01

Changes from v1:
- TINFO about amount of data written to zram device changed to TPASS

Shortened patch description from v1:
The compression ratio check in zram01.sh is completely broken. Here's a patch to calculate the compression ratio correctly using sysfs memory usage statistics for each zram device. I currently calculate it as $bytes_written / $mm_stat_compr_data_size.

One question for debate is whether I should use a different formula:
- $bytes_written / $mm_stat_mem_used_total
(mem_used_total includes internal zram memory management overhead)
- $mm_stat_orig_data_size / $mm_stat_compr_data_size (zram01.sh fills the zram device with binary zeroes so the data will be compacted even before compression; orig_data_size << bytes_written)
- $mm_stat_orig_data_size / $mm_stat_mem_used_total)
(this could easily produce ratio <100% due to page compacting)
See https://www.kernel.org/doc/Documentation/blockdev/zram.txt

Martin Doucha (1):
Fix compression ratio calculation in zram01

 .../kernel/device-drivers/zram/zram01.sh      | 38 +++++++++----------
 1 file changed, 17 insertions(+), 21 deletions(-)
Signature · 1 line
2.23.0