Re: new swap cache regime

Linus Torvalds (torvalds@transmeta.com)
Sun, 27 Sep 1998 11:12:37 -0700 (PDT)


On Sun, 27 Sep 1998, Andrea Arcangeli wrote:

> On Fri, 25 Sep 1998, Stephen C. Tweedie wrote:
>
> >There is only one flaw I can see in this patch as it stands (and my own
> >had exactly the same flaw). If we kill a process which refers to swap
> >pages still in the swap cache, then we no longer free the swap pages if
> >that process was the last user of the swap entry: we have to wait for
> >shrink_mmap() to free the corresponding swap cache pages before the swap
> >entries become reusable. That's not much of a problem in most cases,
> >however, and I'm not sure it warrants the expense of dealing with
> >(because we certainly cannot afford to make the normal exit(2) path
> >longer).
>
> I' ve tryied to make swap_free more clever. There' s to say that the O(n)
> search in the swap cache is done only when the exit(2) is run by a swapped
> out process. So it won' t hurt performance of systems with lots of ram or
> exit path of _not_ swapped out processes.

I really don't think this is the correct approach.

If the only problem is that we cannot do a "swapoff()" on the device, we
should just make swapoff() know about the swap-cache, and walk the page
list. That's fairly easy to do, and implies zero overhead for the exit()
case.

Linus

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