On Fri, Jun 05, 2020 at 05:55:26PM +0200, Igor Raits wrote:
On Fri, 2020-06-05 at 15:11 +0100, Richard W.M. Jones wrote:
> I'm unclear: that ~50M is still in RAM? Or it's compressed on a disk
> somewhere?
IIUC, it takes some part of the RAM and just compresses it on the fly.
For example, I have 32G memory on my laptop and when I enable zram
device, I basically have 23G listed in free as memory and 11G as the
swap. And that 11G is supposed to be compressed memory (in avg cases
with 2:1 ration).
Of course, as part of this change, it will be made that it can't take
more than 4G no matter what by default.
Thanks - the fact that the primary swap partition now lives in RAM is
what I was missing.
But let's say we also add a lower priority disk swap, then my next
question ...
> Also does the swap partition on disk contain compressed pages,
or
> uncompressed pages, or a mix of both?
With zram there is no partition on disk, or was this question about
something else?
... means: Does this secondary swap partition (on disk) contain
swapped out zram pages? Or uncompressed pages? (Or maybe the
question just makes no sense, I don't really know.)
> Also what is the compression algorithm? zlib or zstd or
something
> else?
zramctl shows ALGORITHM
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 lzo-rle 11.7G 4K 74B 12K 8 [SWAP]
So it is lzo-rle by default, but it should be possible to override this
algorithm. There is an RFE for this already at zram-generator github.
Interesting, thanks. It looks like zstd is an alternative, although I
don't know which will be better/faster.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top