Phoronix: ZRAM Finally Promoted Out Of Staging In Linux Kernel
ZRAM has finally been promoted out of staging and into the main area of the Linux kernel within the block subsystem...
hopefully it has an lz4 plugin which shouldn't have much if any peformance hit. i'm using lz4 in my application and its fast fast. Problem is the actual memory allocation/deallocation overhead is hurting me much worse than the compression/decompression. I'm testing very heavy thread loads with 40 hardware threads.
Last edited by bnolsen; 12-18-2013 at 11:48 PM.
However, I have been googling around and you can use zswap with some parameters to get the same result. Mount the TMPFS FS with the memory restrains u used on the ZRAM blocks.
And then use TMPFS instead of a FS on a ZRAM backed block device.Code:zswap.enabled=1 zswap.max_pool_percent=100 zswap.compressor=lz4
I'm seriously confused why these things have to be two seperate implementations. The only thing ZRAM adds over ZSWAP is that it exposes the RAM as a block device. That is all. But hey, I'm just an end-use who am I to argue? .
I set this to 100 to only use 'real' swap as a last resort. I also turned off swap with 'swapoff -a' which succeeded without complaints. Maybe the term swap is not to be seen as something as a physical device containing contents that should belong in memory, but more as not directly accessible memory (i.e. compressed in this context).Code:/* The maximum percentage of memory that the compressed pool can occupy */ static unsigned int zswap_max_pool_percent = 20; module_param_named(max_pool_percent, zswap_max_pool_percent, uint, 0644);
However, I'm in no way an expert in this so I might be way off base.
The advantage of zswap in this regard is that compression will only happen once memory starts going low (vm.swappiness). As far as I know, zram always compresses the content you give it. Which in scenario's where a lot of memory is free, is not necessary.
When you did swapoff -a, you also disabled zswap.
As far as I know, the requirement for a backing "real" swap device for zswap still exists.
That's correct, but if you use zram as a swap device, it gets used only on memory pressure.As far as I know, zram always compresses the content you give it.
See? This is why this topic is so confusing. Multiple approaches doing the same thing
It's only the same thing when you have real swap