[linux-mm-cc] Swapping to RAM activates harddrive.

John McCabe-Dansted gmatht at gmail.com
Wed Jul 27 10:13:56 EDT 2011


On Wed, Jul 27, 2011 at 8:35 PM, Ole Tange <ole at tange.dk> wrote:
> I am trying to test compcache on my 8 GB laptop before putting compcache
> into production on our 256 GB servers.
>
> It is, however, not working out very well.
>
> - o -
>
> For my first test I want to compress swap to RAM without touching the disk
> drive at all. I have disabled back storage and stopped swapping to my normal
> swap partition.
>
> I run a program that eats up a lot of memory but the memory is highly
> compressible (containings 80 * 100M strings with 'X')
>
> When the program hits 6 GB the disk becomes active. I can understand why the
> swap becomes active at 6 GB (that is the whole idea), but why does the DISK
> become active?

My guess is that the system is starting to evict pages from the page
cache, this wouldn't directly cause disk access (unless the pages are
dirty), but it may cause the occasional cache miss. Perhaps you could
use a tool like iotop to see how heavy the disk access is, and what
the direct cause of the disk activity is.

It appears that your cannot rzcontrol is not compatible with your
module. Perhaps when you modprobe you are loading the version of the
module included with your distro, but using rzcontrol from upstream?
You could try using insmod to manually load the upstream module (as in
"insmod ramzswap.ko", when in the same directory as the upstream
module).

Once you get rzcontrol working, you'll probably want to set the size
of ramzswap to at least 6GB. Note that you can safely set the size of
the ramzswap device to be over 100% of the size your RAM, if you know
that the data is compressible. I recall that I tended to get a 4:1
compression ratio on 64bit Ubuntu.

Linux usually favours evicting page cache over swapping, according to
[1] programs can use up to 80% of ram before it starts swapping. You
could try "echo 100 >     /proc/sys/vm/swappiness" to encourage use of
ramzswap before too much page cache has been evicted.

There is also zcache, that may make more efficient use of the memory
allocated to page cache, but I haven't tried it myself.

[1] http://lwn.net/Articles/83588/



-- 
John C. McCabe-Dansted


More information about the linux-mm-cc mailing list