Re: patch cow-swapin [was Re: Very bad swap bug -- 2.0, 2.1 at least]

Stephen C. Tweedie (sct@redhat.com)
Thu, 24 Sep 1998 12:46:21 +0100


Hi,

On Thu, 24 Sep 1998 11:55:58 +0200 (CEST), Andrea Arcangeli
<andrea@e-mind.com> said:

> The point is that 2.1.x has the swap cache. Currently the swap cache
> is only an overhead since as now it isn' t caching nothing. The swap
> cache currently make sense only if nobody would write on the swapped
> out pages anymore.

Umm, you'd better read the kernel again! The swap cache _is_ used, a
great deal. Currently it has two main functions: when we read in a
page from swap for a read access, the swap cache keeps a reference to
the swap entry on disk so that a subsequent swapout of the same page
can avoid writing the page back to disk.

Secondly, as you refer to, if we have multiple process sharing the
same swap entry, the swap cache is the only mechanism we have for
finding an existing in-memory copy of a page which may have been
swapped in by a different process.

In either case, the swap cache is most definitely beneficial. It is
also not much of an overhead: there is zero memory overhead involved
(we don't create copies of the page but map them directly, and the
page cache headers are statically allocated), and only a page-cache
lookup overhead on swapin.

> I am currently working (also Sthepen is working on that) to give a
> _sense_ to the swap cache since it seems to be the right thing to
> do.

It already has a sense. The fact that it can equally be used for
other things such as swap readahead doesn't detract from the important
functions it already performs.

--Stephen

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