How does the output of zramctl relate to swapped memory usage?
1
vote
0
answers
91
views
I have a Raspberry PI 5 with 8GB of ram. I have allocated a zram swap partition with disksize of 1GB, which after a few days is now being used.
$ free -hw
total used free shared buffers cache available
Mem: 7.8Gi 4.1Gi 390Mi 258Mi 855Mi 3.1Gi 3.6Gi
Swap: 1.0Gi 694Mi 329Mi
$ zramctl
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 lzo-rle 1G 445.6M 78.4M 82.6M 4 [SWAP]
$ zramctl --output-all
NAME DISKSIZE DATA COMPR ALGORITHM STREAMS ZERO-PAGES TOTAL MEM-LIMIT MEM-USED MIGRATED MOUNTPOINT
/dev/zram0 1G 445.6M 78.4M lzo-rle 4 263 82.6M 0B 116.5M 5.3K [SWAP]
The "free" program states that I am using about 70% of my zram swap (~700MB). The graphical memory display of "top" agrees with this.
Looking at zramctl, it agrees on disksize, but the only way I can make any sense of this is to assume that my swap contains 445.6MB of swapped data (compressed from ~700MB).
If this _is_ the case, what is the meaning of the other columns in zramctl output (most importantly, COMPR, TOTAL, & MEM-USED). If not, please point out my misunderstanding.
I have read the kernel documentation, but that is mostly regarding the zram "core", rather than actual operation of swap.
Asked by m4r35n357
(111 rep)
Feb 27, 2025, 03:10 PM
Last activity: Jul 28, 2025, 12:09 PM
Last activity: Jul 28, 2025, 12:09 PM