[plug] Invisible swap?

Mark Haselden levsky at neubauten.iinet.net.au
Wed Nov 6 13:33:52 WST 2002


On Wed, Nov 06, 2002 at 01:18:27PM +0800, Bernard Blackham wrote:
> Plug,
> 
> No problems here for now, just sheer curiosity. Why does the
> following work:
> 
> My machine has 256MB RAM, and 512MB (roughly) of swap space. I fire
> up mozilla, openoffice, amongst others, and I get the following:
> 
> # free
>              total       used       free     shared    buffers     cached
> Mem:        257124     250228       6896          0      11480     128572
> -/+ buffers/cache:     110176     146948
> Swap:       498004     135712     362292
> 
> Out of curiosity, I type
> 
> # swapoff -a
> and a few seconds later it returns with no errors. free shows
> 
> # free
>              total       used       free     shared    buffers     cached
> Mem:        257124     252444       4680          0       9100      69260
> -/+ buffers/cache:     174084      83040
> Swap:            0          0          0
> 
> Note that used memory went up by about 2MB, buffers/cache went up
> by 64MB, and used swap fell by roughly 135712KB...
> 
> And the machine works perfectly still. So was most of that 135MB of
> apparently used swap not really doing anything? If whatever was in
> swap wasn't needed, can similar be said for what is actually in
> memory? Do I infact even need swap if I want to open up several huge
> apps whilst doing kernel compiles?
> 
> So many questions. Any enlightenment is welcome :)

Hi Bernard.

You mean that your cache fell by about 64M - ie, due to the data that had
to be swapped back into main RAM when you turned swap off, you've now
got less RAM to waste on cache?  That's consistent with swap being
turned off - the second line that you're looking at is the amount of ram
adjusted to not count the stuff you're using for cache/buffers.

As to the other 64M, I'm not 100% but I would suspect that it has
to do with the Linux VM being very swap averse (which is mostly good).  It
might be that there was some old stuff being stored in there that since
VM was never filled on the machine, that there was no good reason to
swap it out (until of course you turned swap off).  Now, I'm just making
this bit up - it sounds plausible, but I'm not sure that it's actually
true.  I've got a really nice flowchart at home of the current linux VM
that I'll forward on when I get back from work (provided I can dig it
up), and I'll see whether it is actually a plausible comment :)

Cheers

Mark

-- 
Being a Unix system administrator is like being a tech in a biological 
warfare laboratory, except that none of the substances are labeled 
consistently, any of the compounds are just as likely to kill you by 
themselves as they are when mixed with one another, and it is never 
clear what distinction is made between a catastrophic failure in the lab 
and a successful test in the field. 

Michael Tiemann 



More information about the plug mailing list