Open rekcodocker opened 1 year ago
Apparently zswap is better than zram.
That is not true, but it depends on the use case. zswap alone does not avoid disk swapping but is an additional RAM buffer for it. So without a disk swap, which one might not want to have at all, zswap is not used. zram is a way to practically increase the amount of data stored in RAM without any disk swap file. Which one you prefer, highly depends on idle and peak RAM usage vs amount of RAM. EDIT: I should have read your other points, which state the same, invalidating your first statement 😛.
I don't know how to add the zstd and z3fold modules to initramfs on a raspberry
RPi does not use/need an initramfs by default. It shouldn't be needed for zswap either, since the swap space is not mounted in initramfs stage, but in userspace, where the modules can be loaded already.
Basically, with any compressed RAM space, you trade RAM size with CPU processing and I/O speed, since of course making use of the compression is/needs to start before the RAM is actually full. So I'm not yet sure whether it is a good default choice. But an option for it does definitely not hurt.
Creating a feature request
Is your feature request related to a problem? Please describe:
The small devices on which DietPi runs do not have a lot of memory. Swapping is a solution but on SD cards this is gives new meaning to the word 'slow' and it wears out the SD card.
Describe the solution you'd like:
I would like to see zswap (not to be confused with zram!) enabled. The module is available in the kernel and can be activated on boot; I tried it. When this is added to /boot/cmdline.txt, zswap is activated:
zswap.enabled=1
Describe alternatives you've considered:
Most ideal would be if the initramfs would contain zstd and z3fold. Those modules make even better use of compressed swapspace. This would need to be added to the commandline:
zswap.enabled=1 zswap.compressor=zstd zswap.zpool=z3fold
Additional context
Reference: #6041 is about zram and if this FeatureRequest is adressed, it touches on configuring zram.