Re: 2.4 and 2GB swap partition limit

Stephen C. Tweedie
2001-05-02T10:25:20Z

Hi,

On Tue, May 01, 2001 at 06:14:54PM +0200, Rogier Wolff wrote:

> Shouldn't the algorithm be:
>
> - If (current_access == write )
> free (swap_page);
> else
> map (page, READONLY)
>
> and
> when a write access happens, we fault again, and map free the
> swap-page as it is now dirty anyway.

That's what 2.2 did. 2.4 doesn't have to.

The trouble is, you really want contiguous virtual memory to remain
contiguous on swap. Freeing individual pages like this on fault can
cause a great deal of fragmentation in swap. We'd far rather keep the
swap page reserved for future use by the same page so that the VM
region remains contiguous on disk.

That's fine as far as it goes, but the problem happens if you _never_
free up such pages. We should reap the unused swap page if we run out
of swap. We don't, and _that_ is the problem --- not the fact that
the page is left allocated in the first place, but the fact that we
don't do anything about it once we are short on disk.

--Stephen