Configuration - piyushgarg/ZRAM-Swap-Config-Magisk-Mod GitHub Wiki

ZRAM Swap Configurator Optionals

What's ZRAM Swap?

Simple Explanation of ZRAM Swap

An app task memory 100 MB for example  > 100 MB running in RAM while the app is opened > If we go directly to home without closing the app, the 100 MB will be cached in RAM > If we open another new app and the RAM is full enough, the 100 MB will be compressed to 35 MB and it's still in RAM, not going anywhere, so we have 65 MB free RAM for the new app. This compression is called as ZRAM Swap. ZRAM is swapping from normal file to compressed file and vice-versa, so it's also called as Swap. ZRAM Swap is faster, better, & safer than the old and depracated Swap Partition and Swap File, so do not use swap partition nor swap file if you are using ZRAM Swap.

For more detailed information, please read it at Android & Google documentation instead! This module is a tool for advanced users only. There will never recommendations nor restrictions. All at user respective policies. Do not use this if you don't even know what is this! DwYOR!

You can create /data/media/0/optionals.prop or /sdcard/optionals.prop file yourself if it's not exist yet (if you are not in user 0, then change the 0 to your current user) using @mtmanager or any file manager and write any modified settings bellow inside the optionals.prop file BEFORE INSTALLING/REINSTALLING THE MODULE:

ZRAM Swap Configurator resizes your device ZRAM Swap disk to 3 GB as default. But you can use ANY different value. M for Mega Byte. G for Giga Byte. This bellow is for example only. You can modify to any M or G value you want:

Options

  • Example to resize your device ZRAM disk to 768 MB instead:

zram.resize=768M

  • Example to resize your device ZRAM disk to 4 GB instead:

zram.resize=4G

You can also use percentage (%) of RAM size as ZRAM size. This bellow is for example only. You can modify to any percent (%) you want:

  • Example to resize your device ZRAM disksize to 75% of RAM size instead:

zram.resize=75%

  • Example to resize your device ZRAM disksize equals to RAM size instead:

zram.resize=100%

  • Disables your device ZRAM disk instead:

zram.resize=0

You can also change the comp_algorithm instead of your default kernel/ROM/device setting. Example of algorithm from newer to older is zstd, lz4, lzo, & deflate. This bellow is for example only. You can modify to any type of algorithm you want, DEPENDING ON YOUR KERNEL SUPPORT:

  • Example to change your device ZRAM comp_algorithm to zstd instead:

zram.algo=zstd

  • Example to change your device ZRAM comp_algorithm to lz4 instead:

zram.algo=lz4

  • Swap priority is set to 0 by default. You can also set higher priority. For example, if you want to change priority to 5:

zram.prio=5

  • /proc/sys/vm/swappiness is set to 100 by default. If you want to set a lower value like 99 for example:

zram.swps=99

  • swap_free_low_percentage is set to 0 by default. If you want to set another value like 3 for example:

zram.sflp=3

  • /proc/sys/vm/swap_ratio_enable is set to 1 by default. If you want to disable it instead:

zram.swpre=0

  • /proc/sys/vm/swap_ratio is set to 100 by default. If you want to set a lower value like 99 for example:

zram.swpr=99

  • This module removes thrashing_limit_critical by default because it's really interferes multi tasking and swap. But if you still want to keep it:

zram.tlc=1

REINSTALL THE MODULE AFTERWARDS and reboot. source