Zram

Zram compressed ramdisks
Zram was originally started in a project called compcache. It is now included as part of the kernel sources since 3.2.

Introduction
What it does is create a compressed block device in ram. That block device can then be used for swap or general purpose ram disk. The two most popular uses for it are swap to extend the available amount of ram to processes and /tmp. The ram used for the block device is dynamicaly obtained and released up to it's predefined uncompressed maximum size. The way it extends the amount of available ram to a system is by using a portion of the ram as compressed swap. It can therefore hold more pages of memory in the compressed swap than the amount of actual memory used. It also is much faster at swapping pages than typical hard disk swap.

Caveats/Cons
Each zram device contains it's own compression buffer, memory pools and other metadata as well as per-device locks. This can become a serious bottleneck for multi-core machines. To work around this problem, zram is capable of initializing multiple devices. The recommended amount of devices for swap is 1 per cpu core.

For systems with limited memory, non swap use can reduce the amount of available memory to run applications.

Enabling Zram
I recommend you enable zram as a loadable module. The reason is the number of devices created are set during loading. If you compile the module into the kernel, it will default to 1 device and size it to 25% of total memory. It is possible to re-configure the size later, but I don't know how you can set the number of devices during boot.

Gentoo/OpenRC init script
By far the easiest method of utilizing zram disk(s) is by using Martin Väth's zram-init script. Currently it is available in his mv overlay.