Subject: Re: What's in my swap
To: None <current-users@NetBSD.org>
From: Paul Ripke <stix@stix.id.au>
List: current-users
Date: 08/02/2006 18:33:20
On Tue, Aug 01, 2006 at 12:36:31PM +0000, Martijn van Buul wrote:
> It occurred to me that Greg Troxel wrote in gmane.os.netbsd.current:
> > Generally vsz-rss is memory in the address space of a process that
> > isn't backed by real memory, and thus in swap space, probably with
> > some fuzz.
> 
> With some significant fuzz, at that :)
> 
> (snipped ps output)
> 
> [more follow]
> 
> RSS is *always* bigger than VSZ. This machine isn't swapping right now, but
> this would indicate that a process would be significantly swapped out (See
> the zsh's) before "VSZ-RSS" even hits 0.

More anomolies:

USER       PID %CPU %MEM   VSZ    RSS TTY    STAT STARTED      TIME COMMAND
postgres   327  0.0  2.4  2860  25360 ttyE0- S<    1Jun06   3:52.31 postmaster: writer process    (postgres)
mysql     1309  0.0  0.0 48120   6456 ttyE0- IWa   1Jun06 441:58.90 /export/mysql-4.1.7-2/libexec/mysqld 
www      12156  0.0  0.0  7752      4 ?      IW   Tue02AM   0:05.91 /usr/pkg/sbin/httpd -k start
www      14145  0.0  0.0  7672      4 ?      IW   Tue02AM   0:10.20 /usr/pkg/sbin/httpd -k start

This is on 3.0, currently. Also, I note that triggering httpd to do
some work when in the above state doesn't always result in any paging.
Would I be right in thinking that RSS doesn't include inactive pages?
Also, all the page sharing and sparse allocations makes all these
numbers rather open to careful interpretation. I guess pmap(1) could
help here, somewhat. Eg.  postgres above consists mostly of a large
lump (64 MiB) of SysV SHM.

FYI: from top(1) I have:
Memory: 494M Act, 249M Inact, 8704K Wired, 29M Exec, 393M File, 3364K Free
Swap: 4096M Total, 160M Used, 3936M Free

Cheers,
-- 
stix