Re: swap cache

Stephen C. Tweedie (sct@redhat.com)
Sat, 19 Dec 1998 13:14:33 GMT


Hi,

On Sat, 19 Dec 1998 13:45:23 +0100 (CET), Rik van Riel
<H.H.vanRiel@phys.uu.nl> said:

> On Sat, 19 Dec 1998, Prasun Kapoor wrote:
>> > Linux VM, but we don't need that functionality: in Linux we have always
>> > swapped out ptes on a per-page-table basis, not on a per-physical-page
>> > basis. We *DO* swap processes out independently.
>>
>> I dont think I understand. The whole idea of doing it globally is
>> to do some kind of LRU on a global scale and swap out pages based
>> on that.

> This terribly fragments swap space -- you seem to be forgetting
> that we also need to swap things back _in_ and that is most
> efficient when the process' pages are contiguous on disk.

Rik, that's part of the reason why a lot of Unixen preallocate the swap
space for processes: it's impossible to fragment that space after the
initial allocation.

Of course, this mechanism has its own drawback: you can't stream pages
out to swap as rapidly in this case if you are swapping out purely on a
per-physical-page basis. If swap is preallocated then you need to swap
out pte-based chunks at once in order to sustain good bandwidth to swap.

> LRU is just a good guess, the method Linux uses might be a bit
> worse on swap-out, but since we do less disk _seek_ I/O we come
> out slightly ahead of the normal way...

It does better on swapout than a preallocated swap mechanism, and better
on swapin than a dynamic swap allocation mechanism with
per-physical-page swapout.

I'm pretty comfortable with the current design. :)

--Stephen

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