Re: cache/swap issues under 2.4.1, 2.4.2

Marcelo Tosatti (marcelo@conectiva.com.br)
Mon, 26 Feb 2001 13:42:27 -0300 (BRT)


On Mon, 26 Feb 2001, Mordechai T. Abzug wrote:

> Why do I have 47MB of swap in use? I thought at first that it might
> be due to the minimum allowable cache size, but considering that there
> was only 48MB of RAM in use to begin with, that still seems
> suspicious. Even weirder, if I then turn off swap, the usage looks
> more reasonable:
>
> # swapoff -a
>
> # free
> total used free shared buffers cached
> Mem: 255564 53900 201664 0 840 9356
> -/+ buffers/cache: 43704 211860
> Swap: 0 0 0

The "used" swap space here means _allocated_ swap space, not necessarily
used swap space.

Linux 2.4 allocate's swap space for an anonymous page when it unmaps a
page table entry mapping the page. When it allocates the swap space, it
also adds the page to the swapcache to be written later.

The swapcache is part of the pagecache. The swapoff rips all the
swapcached pages on the device, thats why you see a lot less memory
"cached" after the swapoff.

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