Re: strange VM and swap behavior ?

Marc Lefranc (Marc.Lefranc@nordnet.fr)
31 Aug 1999 15:04:36 +0200


"Stephen C. Tweedie" <sct@redhat.com> writes:

> "cached" includes the "swap cache", a mechanism which is used when we
> get a read memory access to a page of swapped memory. When that
> happens, we pull in the page from disk but we don't remove that copy on
> disk --- the copy in memory becomes effectively a local cache of the
> disk copy, and counts as cached memory. If we want to discard that copy
> from memory in the future, we can do so without writing it back to disk
> because we know that the in-memory copy has not been modified since we
> first read it from disk.

Thank you very much for the very clear explanation. This makes sense
to me now.

The only thing I have still difficulties with is the fact that after
terminating xanim, a high amount of swap space remains used:

I guess this is because the swap pages reported by free are actually
one level higher than the actual swap disk blocks, and similar to a
cache. This pages persist even after the process has died.

>> after I kill xanim (we should be back to the initial situation),
>> free reports:

>> total used free shared buffers cached
>> Mem: 96012 70820 25192 4168 1376 63920
>> -/+ buffers/cache: 5524 90488
>> Swap: 101592 64748 36844
>>
>> There should be ~ 12 Mb of running processes and there are 64748 K in
>> swap !
>>
>> Now, I swapoff the two swap areas, and here is the last output of
>> free:
>>
>> total used free shared buffers cached
>> Mem: 96012 18144 77868 4480 1376 4564
>> -/+ buffers/cache: 12204 83808
>> Swap: 0 0 0
>>

> No, the swap cache is using both on-disk swap and in-core memory for the
> same data, just as the page cache contains an in-core memory copy of
> regular files on disk. That is quite deliberate.

And quite effective judging from responsiveness of the system in
situations of heavy swapping.

Does this mean that, for performance reasons, it is wise to reserve a
larger swap space than for the previous kernel generation ? Indeed, we
can arrive at a situation where all running processes will have pages
with copies in the on-disk swap space and in the swap cache. If I'm
correct, this limit case sounds similar as for memory utilization to
what occaurs in unices where the swap space is reserved right when the
process is started, and where the available virtual memory is equal to
the amount of swap space ?

Thanks again a lot,
Marc.

-
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/