Stephen C. Tweedie wrote:
> 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.
first: Thanks for clearing this up for me.
So, there are in fact some more "states" a swap-page can be in:
-(0) free
-(1) allocated, not in mem.
-(2) on swap, valid copy of memory.
-(3) on swap: invalid copy, allocated for fragmentation, can
be freed on demand if we are close to running out of swap.
If we running low on (0) swap-pages we can first start to reap the (3)
pages, and if that runs out, we can start reaping the (2)
pages. Right?
Roger.
-- ** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2137555 ** *-- BitWizard writes Linux device drivers for any device you may have! --* * There are old pilots, and there are bold pilots. * There are also old, bald pilots. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Mon May 07 2001 - 21:00:12 EST