Re: Linux-2.1.129..

Stephen C. Tweedie
1998-11-24T15:38:55Z

Hi,

On 23 Nov 1998 13:46:16 -0600, ebiederm+eric@ccr.net (Eric
W. Biederman) said:

> The simplest model (and what we use for disk writes) is after
> something becomes dirty to wait a little bit (in case of more writes,
> (so we don't flood the disk)) and write the data to disk.

The disk write model is not a good comparison, since (a) our current
write model is badly broken anyway (the only way to throttle writes is
to run out of memory), and (b) there are all sorts of fairness issues
involving the IO queues too in the write case. But they have
similarities.

> Ideally/Theoretically I think that is what we should be doing for swap
> as well, as it would spread out the swap writes across evenly across
> time. And should leave most of our pages clean.

Batching the writes improves our swap throughput enormously. This is
well proven. Sometimes we don't want to be too even. :)

> So I in practicall terms this would either be a call of shrink_mmap
> for every call to swap_out. Or we would need an extra case added to
> the extra shrink_mmap call at the start of do_try_to_free_page.

The patch I just sent out essentially does this. By making swap_out
unlikely to free real memory (it just unlinks things from ptes while
leaving them in the page cache), it batches out our swap writes and
causes regular aging of swap pages when memory gets short, but still
leaves all of the work of balancing the vm to shrink_mmap() where
those unlinked pages can be reused at will.

--Stephen