Re: [2x PATCH] page map aging & improved kswap logic

Stephen C. Tweedie (
Fri, 27 Feb 1998 19:52:10 GMT


On Fri, 27 Feb 1998 10:58:34 +0100 (MET), Rik van Riel
<> said:

> What I wanted kswapd to do, was to select SWAP_CLUSTER_MAX pages and
> swap them out in _one_ I/O operation. Because this should save head
> movement, it might give us an improvement over syncing each swapped
> page seperately.

I'm working towards it, and yes, this is a very important thing to have.
It's more than just head movement --- disk requests, especially on SCSI,
simply go much faster if you can amalgamate a number of physically
adjacent IO requests into a single operation (scatter-gather allows you
to do this even if the memory for the data is not physically

The biggest problem is avoiding blocking while we do the work in
try_to_swap_out(). That is a rather tricky piece of code, since it has
to deal with the fact that the process it is swapping can actually be
killed if we sleep for any reason, so it will not necessarily still be
there when we wake up again. We've really got to do the entire
custering operation for write within try_to_swap_out() and then start up
the IO for those pages.

However, at least with the new swap cache stuff we can make things
easier, since it is now possible to set up swap cache associations
atomically on all the pages we want to swapout, and then take as much
time as we want performing the actual writes. All we need to do is make
sure that we lock all the pages for IO without the risk of blocking.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to