zram is awesome! PBP is awesome! zram on PBP is awesome^2!
#6
(06-17-2020, 11:26 AM)Surehand53 Wrote:
(03-20-2020, 09:34 PM)moonwalkers Wrote: This basically puts the amount of memory used at about 9.5GiB (used + DATA - TOTAL), that's on a system with only ~3.7GiB RAM available!


Code:
$ free -h; zramctl
total        used        free      shared  buff/cache   available
Mem:          3.7Gi       3.5Gi        34Mi        84Mi       224Mi       114Mi
Swap:          14Gi       7.9Gi       7.0Gi
NAME       ALGORITHM DISKSIZE  DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 lzo-rle      14.8G  7.9G  1.9G  1.9G       6 [SWAP]

And the system is still surprisingly responsive for a low-power CPU.

Hi moonwalkers.

After your enthusiastic description I thought I try zram.
I have used this guide to set it up and it seems to work
https://www.techrapid.uk/2017/04/create-...linux.html

Is that similar to what you are using ?
And more crucially, How do I get to the 9 Gi free mem. If I understand correctly I have 6 Gi from my guide ?
I used a bit different approach. My setup involves three files:
Code:
$ cat /etc/modules-load.d/zram.conf
zram

$ cat /etc/udev/rules.d/10-zram.rules
KERNEL=="zram0", SUBSYSTEM=="block", ACTION=="add", ATTR{initstate}=="0", PROGRAM="/bin/sh -c 'echo $(($(LANG=C free -k | sed -nr s/^Mem:\ *\([0-9]+\)\ +.*$/\\1/p)*4))KiB'", ATTR{disksize}="$result", RUN+="/sbin/mkswap $env{DEVNAME}",TAG+="systemd"

$ cat /etc/fstab
LABEL=pine-RootFS   /         ext4 defaults,relatime 0 1
PARTLABEL=pine-Boot /boot     ext4 defaults,relatime 0 2
PARTLABEL=pine-EFI  /boot/efi vfat defaults,relatime 0 2
/dev/zram0          none      swap sw                        0 0
This leaves compression method as default lzo-rle instead of lz4 - I prefer slightly better compression ratio of lzo over the performance of lz4, especially since I haven't noticed much perceived performance difference between the two. The tweaking of the zram swap size is done with the multiplier near the end of the PROGRAM expression, I currently use *4, which means four times the available RAM, but I've never really reached that usage level, maximum I was ever able to utilize is about 2.5xRAM, so 3xRAM will be more than enough. In other systems I've used 2xRAM, and typical setting in Chromebooks or Amazon Linux WorkSpaces, for example, is 1.5xRAM.

As to the "free memory" - just to clarify, you'll never get more free memory than what your PBP physically has, but zram can allow you to put more stuff in that memory by compressing that stuff. That means if the apps you run fill their memory pages with patterns that are not easily compressible by the lzo or lz4 algorithm you will run out of RAM even if you have "plenty free space" in your zram swap, your system will slow down and may even have OOM killer going on a hunt. But if you run apps that fill memory with patterns that can be easily compressed then you will achieve the result I've described above and maybe even better. The reason I use high zram to RAM ratio is because in my experience the system behavior is similar regardless of which way the system runs out of memory, swap space on zram first or RAM to allocate for zram first, but with bigger zram I get more leeway in case the data is well compressible (seems to be the case for browsing).
This message was created with 100% recycled electrons


Messages In This Thread
RE: zram is awesome! PBP is awesome! zram on PBP is awesome^2! - by moonwalkers - 06-17-2020, 01:26 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  zram swap support for the PBP; aka: "how to download more RAM" Arglebargle 10 13,140 02-02-2020, 10:53 AM
Last Post: moonwalkers

Forum Jump:


Users browsing this thread: 2 Guest(s)