[CentOS] Swap memory: I can't reconcile this stuff.

Mon Jun 5 23:02:01 UTC 2006
Rodrigo Barbosa <rodrigob at suespammers.org>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, Jun 05, 2006 at 06:45:10PM -0400, William L. Maltby wrote:
> I need to look more into it, but before I start the long and arduous
> "googling my life away" process, I figured someone might know the
> answer. I've read the man pages several times and they didn't change!
> :-(
> 
> As normal, while looking at one thing, something else bites my butt. I
> tuned on the swap field in top and sort on it. Here's an edited snippet
> of the results.
> 
> Mem:    775708k total,   764752k used,    10956k free,    60780k buffers
> Swap:  1572856k total,      160k used,  1572696k free,   377324k cached
> 
>   PID  VIRT  RES  SHR %MEM SWAP COMMAND
> 24729  127m  32m  15m  4.3  94m evolution
>  3409 97220 5268 4304  0.7  89m evolution-data-
>  2851  115m  36m 7120  4.8  79m X
>  3359 19904 6128 5316  0.8  13m gnome-volume-ma
(...)
>  3355 14768 7524 5984  1.0 7244 metacity
>  7182 10328 3436 2280  0.4 6892 sendmail
> 18501 11080 4248 1912  0.5 6832 cupsd
> 
> Note that the summary line says 160k of swap is used. The man pages say
> the summary and the details under "SWAP" are both reported in "k". No
> mention of "m" is made, I presume that it means "megabytes"?
> 
> If so, I can't reconcile what I'm seeing. Free seems to support the
> summary lines.
> 
>              total       used       free...
> Mem:        775708     764772      10936...
> -/+ buffers/cache:     326584     449124
> Swap:      1572856        160    1572696
> 
> Cat of /proc/meminfo also seems to support the summary lines.
> 
> SwapTotal:     1572856 kB
> SwapFree:      1572696 kB
> 
> Now, if I treat all those numbers ending in "m" as megabytes, it doesn't
> take long to see that I've been lied to somewhere along the way. Or
> alternatively, I'm dense and "Just Don't Get It" (TM).
> 
> Any help?

I can see two possible explanations for this. Maybe both in conjunction.

One is that you get getting multiple entries for the same processes,
but different threads. That used to be the way of it up until .. humm,
not sure ... 2.4, I guess. Not sure exactly how it works these days. I would
have to check.

The other is the overcommit kernel feature. It is possible the kernel
is overcommiting memory, and thus showing more than it really in
use.

One last thing possible (just thought about it) is that top is adding
more than one namespace to those totals. Maybe shared memory (/dev/shm ?).
Or any other possible namespace.

I agree it does seem odd, and I have seen this kind of stuff happening
before. Once I started hunting it down, and found the reason for it.
It was some time ago (2.2 ? 2.4 ? Not sure), so I'm reasonably sure
it is not the same reason these days. But I hope I gave you are
least some pointers for where to start looking.


- -- 
Rodrigo Barbosa <rodrigob at suespammers.org>
"Quid quid Latine dictum sit, altum viditur"
"Be excellent to each other ..." - Bill & Ted (Wyld Stallyns)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFEhLfppdyWzQ5b5ckRArwRAKCmZiNBRKpo4H+w9yz7iOFxPDXpWQCeMUUB
xl9CoW3fjVtw3oYRSFFWfQU=
=BOYa
-----END PGP SIGNATURE-----