Re: [PATCH] swapin readahead and fixes

Rik van Riel (H.H.vanRiel@phys.uu.nl)
Tue, 8 Dec 1998 03:31:25 +0100 (CET)


On Mon, 7 Dec 1998, Billy Harvey wrote:

> Has anyone ever looked at the following concept? In addition to a
> swap-in read-ahead, have a swap-out write-ahead. The idea is to use
> all the avaialble swap space as a mirror of memory.

We do something a bit like this in 2.1.130+. Writing out all
pages to swap will use far too much I/O bandwidth though, so
we will never do that...

> If a need for real memory comes up, and a page has been marked as
> mirrored, then it can be immediately reused without swapping out.
> The trick would be in deciding how to write-ahead without taking
> significant execution time and disk access time away from other
> processes, that is with no impact to active processes.

We will probably want to implement a kind of write-ahead
algorithm for swapout though, but a slightly different one
than you envisioned.

On a swapout, we will scan ahead of where we are (p->swap_address)
and swap out the next number of pages too. We break the loop if:
- the page isn't present or already in swap
- the next two pages were touched since our last scan
- the page isn't allocated
- we reach the end of a SWAP_CLUSTER area in swap space

If we write this way (no more expensive than normal because
we write the stuff in one disk movement) swapin readahead
will be much more effective and performance will increase.

cheers,

Rik -- the flu hits, the flu hits, the flu hits -- MORE
+-------------------------------------------------------------------+
| Linux memory management tour guide. H.H.vanRiel@phys.uu.nl |
| Scouting Vries cubscout leader. http://www.phys.uu.nl/~riel/ |
+-------------------------------------------------------------------+

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