4

I'm trying to estimate how effective the zram kernel module is in case of my PC. I have a pretty old machine (7y) with the only 1 GiB of RAM.

I created two zram swaps (two core processor), 250MiB each, and everything seems to be working:

# swapon -s
Filename                                Type            Size    Used    Priority
/dev/mapper/debian_crypt-swap           partition       2097148 0       10
/dev/zram0                              partition       255996  203404  70
/dev/zram1                              partition       255996  203284  70

I found a script zraminfo which can calculate the compression ratio:

# ./zraminfo.sh
Physical memory:      1,049,821,184 bytes
Buffers and cache:      116,097,024 bytes / 11.1% of total memory
Unallocated:             81,043,456 bytes /  7.7% of total memory
Compressed:             121,118,720 bytes / 11.5% of total memory
Uncompressed size:      346,472,448 bytes / 2.861 compression ratio

So, after decompressing 121M, I will get +200M extra. But one thing, why is there 200M in each zram device? Shouldn't be there 2*200M compressed data, and 1,2G uncompressed?

slm
  • 363,520
  • 117
  • 767
  • 871
Mikhail Morfikov
  • 10,309
  • 19
  • 69
  • 104

0 Answers0