Re: strange VM and swap behavior ?

Marc Lefranc (Marc.Lefranc@nordnet.fr)
29 Aug 1999 21:55:16 +0200


Marc Lefranc <Marc.Lefranc@nordnet.fr> writes:

> Summary: I observe strange behavior related to virtual memory and
> swap. When playing an animated gif with xanim, virtual memory can
> eventually be exhausted although the total of physical memory + swap
> is well above what should be needed. Also, the amount of "cached"
> memory is strangely high for a situation of heavy swapping, and there
> seems to be some duplication between swap and the cached pages. VM
> exhaustion seems to depend sensitively on timings.

I apologize for probably posting the previous message without thinking
enough. Returning to this problem after posting, I realized that the
Free swap=0 condition does not mean that VM is exhausted, as I had
first assumed (although this seemed logical). Thus when I wrote VM
exhausted, it should be read top (cand /proc/swaps) report free
swap=0.

In fact, I realized after that even after Free Swap =0, there was some
memory available as I was even able to launch netscape, for example.
The extra memory required seemed to be obtained at the expense of the
"cached" figure, as expected. Even then the response was quite good
given the amount of memory swapped.

I was first shocked by the fact that cached pages seemed to be
swapped, but I guess it is faster to recover them from the swap than
from their original location.

I apologize again for wasting your valuable time. I have still many
things to learn.

Marc.

P.S. Mark Hahn <hahn@coffee.psychology.mcmaster.ca> suggested that:

> it would be interesting to know first whether xanim is reading the file
> by mmap'ing the whole thing (strace will tell you this), and whether
> "echo 1 > /proc/sys/vm/overcommit_memory" changes behavior...

Changing overcommit_memory does not change behavior, and xanim does
not mmap the file. However, it does a lot of mmap/munmap such as:

mmap(0, 462848, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40320000
munmap(0x401e6000, 462848) = 0
mmap(0, 450560, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x401e6000
read(9, ")\315\206\335Rc\5\265eyX\244\6\320"..., 4096) = 4096
read(9, "\271w=\210M\367\223\324J=\331\222"..., 4096) = 4096
brk(0x80ef000) = 0x80ef000

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/