On Fri, Jun 5, 2020 at 7:09 AM Peter Robinson <pbrobinson(a)gmail.com> wrote:
> On 05.06.2020 12:50, Igor Raits wrote:
> > It does not work in some cases even today anyway.
>
> Okay, then the second point - zram will will cause a huge memory
> fragmentation and significantly decrease overall performance.
Have you got proof of that and can provide figures? Having been
running it on Arm and IoT by default for a few releases now it
certainly doesn't cause fragmentation, it's allocated early in the
boot process so it's one single block. I also run zram on my laptop
and it's generally faster as when it has to hit swap that's backed by
RAM and is an order of magnitude faster, even with dealing with
compression, than hitting my NVME SSD.
With one exception, I agree with all of this including better swap
performance than on NVMe (~1500M/s).
/dev/zram0 is definitely not preallocated
$ cat /sys/block/zram0/mm_stat
4096 74 12288 0 12288 0 0 0
$ zramctl
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 lzo-rle 3.9G 4K 74B 12K 8 [SWAP]
]$
This 4G /dev/zram0 device isn't being used by swap right now.
From the kernel documentation:
mem_used_total the amount of memory allocated for this disk. This
includes allocator fragmentation and metadata overhead,
allocated for this disk. So, allocator space efficiency
can be calculated using compr_data_size and this statistic.
--
Chris Murphy