Replacing zram with zswap
Update10 introduced some questionable memory-management adjustments. First of all, zram is not meant to be used in conjunction with a permament memory based swap, as that leads to LRU inversion: older pages get into the higher-priority zram and quickly fill it, while newer pages are swapped in and out of the slower emmc-based swap, so all the advantages of zram are lost and almost 100 MB of RAM are simply wasted. Another issue is the decreased swapiness value: the lowmemory killer kicks in earlier leading to user applictions being killed quite often and sometimes unexpectedly.
Even just disabling zram, decreasing lowmemorykiller minfree values and increasing swapiness leads to an overall usability improvement.
Which minfree and swappiness values have you found best after disabling zram?
synthent ( 2015-01-10 18:40:58 +0200 )editI've used 1024,2048,4096,6144,8192 for minfree and 60 for swapiness, but you probably can set minfree to all zeroes without any adverse effects.
bulkin ( 2015-02-01 17:05:51 +0200 )editOn the contrary I see swap in zram quite useful. I have increased zram swap size from default 13% to 33% and really rarely see that swapped data does not fit in zram swap. Here is typical output of my stats script which calculates some aggregate statistics of zram swap devices.
The most interesting line is "Memory saved" which displays estimate if freed memory by swap in zram. It is calculated as:
orig_data_size(non-zero swapped pages) + zero_pages(zero pages swapped) - mem_used_total(by zram) - SwapCached(cached in RAM swap contents)
~50MB RAM gained. Not bad. In tight memory conditions when SwapCached becomes low and swap in zram becomes more filled space gained might be more than 100MB.
Self-Perfection ( 2015-02-04 18:30:05 +0200 )editJudging by your num_reads, the device uptime is less than a day and you haven't used it very much. Here is the output of you script after 2 weeks of light to regular smartphone usage: http://pastebin.com/DXdBFxyF . Zram is filled completely:
while
free
reports 36 MB free and 114 MB cached. And this is with only settings, messaging and omweather open. If I browse a bit, something will surely be killed by the OOM-killer.Anyway, my feature request is not about reverting to how things were, it is about improving the current situation.
bulkin ( 2015-02-04 18:56:03 +0200 )editWhen I posted my previous comment uptime of my phone was almost two days.
I have a feeling that lipstick leaks memory over time and lipstick is probably the reason of high swap usage on your device. I have never got patience to let lipstick run for more than several days because after a couple of days lipstick starts to constantly use CPU.
Please, post output of following command:
and try to restart lipstick:
I believe that after restarting lipstick your swap usage would drop below 100MB.
Just in case: pmap requires root. Restarting lipstick stop all GUI apps.
Self-Perfection ( 2015-02-05 13:12:13 +0200 )edit