Swap & zram

[Void Linux]

Well, Void & runit don't come with swap OOTB...
Soo...

What is Swap (and zram)?

Swap is extra breathing room for your RAM. When your memory starts filling up, Linux moves stuff you aren't currently using into swap space on your disk. That frees up RAM for whatever you're actively doing so your system keeps running.

But don't think of it like a smooth performance booster. Storage drives, even fast NVMe SSDs, are vastly slower than physical RAM. Swap doesn't make apps run smoothly when memory is full, it mostly just prevents the kernel's "Out-Of-Memory" killer from instantly crashing everything.

zram is a Linux kernel module that takes the same concept, but keeps everything inside your physical memory. Instead of writing to a slow disk drive, zram creates a compressed block device right inside your RAM.

Because modern CPUs compress data really fast, in-RAM compression takes virtually zero noticeable overhead compared to waiting on disk I/O. Think of it like zipping a folder. An 8GB zram setup lets you squeeze 8GB worth of un-used app data down so it only takes up about half that space in real memory.

How to get it?!?!/gf;

You can manually do 27 fucking steps that make no sense, OR you could use a utility called zramen. It handles doing everything, and it can't get simpler than this.

Install zramen

sudo xbps-install -Su zramen

Enable the service

sudo ln -s /etc/sv/zramen /var/service/

Done. runit will start zramen immediately and it would detect your total RAM and create a zram swap device equal to half your RAM using the optimal compression algorithm, and turn it on.

To confirm it's running, you can do zramctl or use system info fetchers like fastfetch.