Discussion:
[linux-mm-cc] Zram and SwapCached
DC-1
2012-07-19 13:39:30 UTC
Permalink
Hi!

I have a question about zram + swapcached. I know that zram is a
compressed swap in memory, but linux use it's own internal SwapCached
area to store recent swap pages _also_ in memory. I have a 512mb laptop
with a ~128mb zram swap drive.
So zram_stats says:
orig_data_size: 97419264
compr_data_size: 40315919

and: grep SwapCache /proc/meminfo
SwapCached: 90200 kB

So does it mean i have these swap pages in ram twice? First
is compressed, and second is uncompressed by linux internal swapcache
feature?
If it is true, it's not very useful to save ~57MB while it's also in
ram with ~90MB.

Anyway: can i disable linux's swapcache feature at all when i'm
swapping to zram? Or can I limit the maximum swapcached area?
Nitin Gupta
2012-07-19 15:15:40 UTC
Permalink
Hi,
Post by DC-1
I have a question about zram + swapcached. I know that zram is a
compressed swap in memory, but linux use it's own internal SwapCached
area to store recent swap pages _also_ in memory. I have a 512mb laptop
with a ~128mb zram swap drive.
orig_data_size: 97419264
compr_data_size: 40315919
and: grep SwapCache /proc/meminfo
SwapCached: 90200 kB
So does it mean i have these swap pages in ram twice? First
is compressed, and second is uncompressed by linux internal swapcache
feature?
There can be some overlap between zram stored pages and the swapcache. The
amount of overlap cannot be determined by any of the exported stats however
this overlap should not be an issue since these pages are expected to be
swapped again soon and in case they are clean (i.e. not modified) since the
last write to zram disk, we avoid re-compressing them since they are
already in compressed RAM.
Post by DC-1
If it is true, it's not very useful to save ~57MB while it's also in
ram with ~90MB.
Anyway: can i disable linux's swapcache feature at all when i'm
swapping to zram? Or can I limit the maximum swapcached area?
swapcache can be disabled only by disabling swap subsystem itself during
kernel compilation. Again, zram + swapcache interaction should not be an
issue and I explained above.

Anyways, please use zram from the mainline kernel where it is being
actively maintained. I do not update the out-of-tree version (as available
in the downloads section) any longer.

Thanks,
Nitin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.laptop.org/pipermail/linux-mm-cc/attachments/20120719/6579a12e/attachment.html>
Loading...