Re: [patch] swap cache read accesses

Stephen C. Tweedie (sct@redhat.com)
Tue, 4 May 1999 18:42:53 +0100 (BST)


Hi,

On Tue, 4 May 1999 13:31:33 +0200 (CEST), Andrea Arcangeli
<andrea@e-mind.com> said:

> I was running `./bw_mem 120m rd' (from lmbench) and I noticed my swap to
> be eaten completly in some second. All the cache was full of swap cache
> pages.

> The problem is that there is no good reason to map in the process a
> read-only swap cache page if the swap cache page was not shared.

Yes there is. That's the whole reason the swap cache was added in the
first place. It means that if we want to reuse the process's physical
memory again, we don't have to write it back to swap.

> Mapping the swap cache page even if it wasn't shared not only cause the
> kerenl to go low of swap entry,

The kernel has _always_ done this, for good reason. If you still go low
on swap, you have too little swap.

> but it will also cause an additional page fault and cow if after the
> read access there will be a write access.

It will cause a page fault, yes, but not a COW: the do_wp_page will just
use the existing swap cache page if there are no other users of the page
(either in memory or in swap). The page fault is there for a reason: it
tells us at which point the page's copy on disk is no longer valid.

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