Subject: Re: What's in my swap
To: None <stix@stix.id.au>
From: Lars Heidieker <lars@heidieker.de>
List: current-users
Date: 08/02/2006 12:28:58
--Apple-Mail-1-113679886
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=ISO-8859-1;
	delsp=yes;
	format=flowed

RSS shows how many pages are mapped in the processes pmap module
VSZ is (at least in my opinion) bogus as is it does not reflect the =20
amount of virtual address space occupied but only
the size of the executables text and data section leaving out a lot =20
of anonymous (swap backed pages) and file mappings.
The pmap command gives you correct values.

Lars

On 2 Aug 2006, at 10:33, Paul Ripke wrote:

> 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 =20=

>> now, but
>> this would indicate that a process would be significantly swapped =20
>> out (See
>> the zsh's) before "VSZ-RSS" even hits 0.
>
> More anomolies:
>
> USER       PID %CPU %MEM   VSZ    RSS TTY    STAT STARTED      TIME =20=

> COMMAND
> postgres   327  0.0  2.4  2860  25360 ttyE0- S<    1Jun06   3:52.31 =20=

> postmaster: writer process    (postgres)
> mysql     1309  0.0  0.0 48120   6456 ttyE0- IWa   1Jun06 =20
> 441:58.90 /export/mysql-4.1.7-2/libexec/mysqld
> www      12156  0.0  0.0  7752      4 ?      IW   Tue02AM   =20
> 0:05.91 /usr/pkg/sbin/httpd -k start
> www      14145  0.0  0.0  7672      4 ?      IW   Tue02AM   =20
> 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, =20
> 3364K Free
> Swap: 4096M Total, 160M Used, 3936M Free
>
> Cheers,
> --=20
> stix
>

Lars Heidieker
lars@heidieker.de

---

Mystische Erkl=E4rungen.
Die mystischen Erkl=E4rungen gelten f=FCr tief;
die Wahrheit ist, dass sie noch nicht einmal oberfl=E4chlich sind.
      -- Friedrich Nietzsche



--Apple-Mail-1-113679886
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=ISO-8859-1

<HTML><BODY style=3D"word-wrap: break-word; -khtml-nbsp-mode: space; =
-khtml-line-break: after-white-space; ">RSS shows how many pages are =
mapped in the processes pmap module<DIV>VSZ is (at least in =
my=A0opinion)=A0bogus as is it does not reflect the amount of virtual =
address space occupied but only</DIV><DIV>the size of the executables =
text and data section leaving out a lot of=A0anonymous=A0(swap backed =
pages) and file mappings.</DIV><DIV>The pmap command gives you correct =
values.</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>Lars</DIV><DIV><BR><DIV><DIV>=
On 2 Aug 2006, at 10:33, Paul Ripke wrote:</DIV><BR =
class=3D"Apple-interchange-newline"><BLOCKQUOTE type=3D"cite"><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">On Tue, Aug 01, 2006 at 12:36:31PM +0000, Martijn =
van Buul wrote:</DIV> <BLOCKQUOTE type=3D"cite"><DIV style=3D"margin-top: =
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">It =
occurred to me that Greg Troxel wrote in gmane.os.netbsd.current:</DIV> =
<BLOCKQUOTE type=3D"cite"><DIV style=3D"margin-top: 0px; margin-right: =
0px; margin-bottom: 0px; margin-left: 0px; ">Generally vsz-rss is memory =
in the address space of a process that</DIV><DIV style=3D"margin-top: =
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">isn't =
backed by real memory, and thus in swap space, probably with</DIV><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">some fuzz.</DIV> </BLOCKQUOTE><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style=3D"margin-top: =
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">With =
some significant fuzz, at that :)</DIV><DIV style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: =
14px; "><BR></DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; ">(snipped ps output)</DIV><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style=3D"margin-top: =
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">[more =
follow]</DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">RSS is *always* bigger than VSZ. This machine isn't =
swapping right now, but</DIV><DIV style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">this would =
indicate that a process would be significantly swapped out =
(See</DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; ">the zsh's) before "VSZ-RSS" even =
hits 0.</DIV> </BLOCKQUOTE><DIV style=3D"margin-top: 0px; margin-right: =
0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; =
"><BR></DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; ">More anomolies:</DIV><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style=3D"margin-top: =
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">USER =
<SPAN class=3D"Apple-converted-space">=A0 =A0 =A0 </SPAN>PID %CPU %MEM =
<SPAN class=3D"Apple-converted-space">=A0 </SPAN>VSZ<SPAN =
class=3D"Apple-converted-space">=A0 =A0 </SPAN>RSS TTY<SPAN =
class=3D"Apple-converted-space">=A0 =A0 </SPAN>STAT STARTED<SPAN =
class=3D"Apple-converted-space">=A0 =A0 =A0 </SPAN>TIME =
COMMAND</DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; ">postgres <SPAN =
class=3D"Apple-converted-space">=A0 </SPAN>327<SPAN =
class=3D"Apple-converted-space">=A0 </SPAN>0.0<SPAN =
class=3D"Apple-converted-space">=A0 </SPAN>2.4<SPAN =
class=3D"Apple-converted-space">=A0 </SPAN>2860<SPAN =
class=3D"Apple-converted-space">=A0 </SPAN>25360 ttyE0- S&lt;<SPAN =
class=3D"Apple-converted-space">=A0 =A0 </SPAN>1Jun06 <SPAN =
class=3D"Apple-converted-space">=A0 </SPAN>3:52.31 postmaster: writer =
process<SPAN class=3D"Apple-converted-space">=A0 =A0 =
</SPAN>(postgres)</DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; ">mysql <SPAN =
class=3D"Apple-converted-space">=A0 =A0 </SPAN>1309<SPAN =
class=3D"Apple-converted-space">=A0 </SPAN>0.0<SPAN =
class=3D"Apple-converted-space">=A0 </SPAN>0.0 48120 <SPAN =
class=3D"Apple-converted-space">=A0 </SPAN>6456 ttyE0- IWa <SPAN =
class=3D"Apple-converted-space">=A0 </SPAN>1Jun06 441:58.90 =
/export/mysql-4.1.7-2/libexec/mysqld<SPAN =
class=3D"Apple-converted-space">=A0</SPAN></DIV><DIV style=3D"margin-top: =
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">www<SPAN =
class=3D"Apple-converted-space">=A0 =A0 =A0 </SPAN>12156<SPAN =
class=3D"Apple-converted-space">=A0 </SPAN>0.0<SPAN =
class=3D"Apple-converted-space">=A0 </SPAN>0.0<SPAN =
class=3D"Apple-converted-space">=A0 </SPAN>7752<SPAN =
class=3D"Apple-converted-space">=A0 =A0 =A0 </SPAN>4 ?<SPAN =
class=3D"Apple-converted-space">=A0 =A0 =A0 </SPAN>IW <SPAN =
class=3D"Apple-converted-space">=A0 </SPAN>Tue02AM <SPAN =
class=3D"Apple-converted-space">=A0 </SPAN>0:05.91 /usr/pkg/sbin/httpd =
-k start</DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; ">www<SPAN =
class=3D"Apple-converted-space">=A0 =A0 =A0 </SPAN>14145<SPAN =
class=3D"Apple-converted-space">=A0 </SPAN>0.0<SPAN =
class=3D"Apple-converted-space">=A0 </SPAN>0.0<SPAN =
class=3D"Apple-converted-space">=A0 </SPAN>7672<SPAN =
class=3D"Apple-converted-space">=A0 =A0 =A0 </SPAN>4 ?<SPAN =
class=3D"Apple-converted-space">=A0 =A0 =A0 </SPAN>IW <SPAN =
class=3D"Apple-converted-space">=A0 </SPAN>Tue02AM <SPAN =
class=3D"Apple-converted-space">=A0 </SPAN>0:10.20 /usr/pkg/sbin/httpd =
-k start</DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">This is on 3.0, currently. Also, I note that =
triggering httpd to do</DIV><DIV style=3D"margin-top: 0px; margin-right: =
0px; margin-bottom: 0px; margin-left: 0px; ">some work when in the above =
state doesn't always result in any paging.</DIV><DIV style=3D"margin-top: =
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Would I =
be right in thinking that RSS doesn't include inactive pages?</DIV><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">Also, all the page sharing and sparse allocations =
makes all these</DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; ">numbers rather open to careful =
interpretation. I guess pmap(1) could</DIV><DIV style=3D"margin-top: =
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">help =
here, somewhat. Eg.<SPAN class=3D"Apple-converted-space">=A0 =
</SPAN>postgres above consists mostly of a large</DIV><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">lump (64 MiB) of SysV SHM.</DIV><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style=3D"margin-top: =
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">FYI: =
from top(1) I have:</DIV><DIV style=3D"margin-top: 0px; margin-right: =
0px; margin-bottom: 0px; margin-left: 0px; ">Memory: 494M Act, 249M =
Inact, 8704K Wired, 29M Exec, 393M File, 3364K Free</DIV><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">Swap: 4096M Total, 160M Used, 3936M Free</DIV><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style=3D"margin-top: =
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; =
">Cheers,</DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; ">--<SPAN =
class=3D"Apple-converted-space">=A0</SPAN></DIV><DIV style=3D"margin-top: =
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; =
">stix</DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV> =
</BLOCKQUOTE></DIV><BR><DIV> <SPAN class=3D"Apple-style-span" =
style=3D"border-collapse: separate; border-spacing: 0px 0px; color: =
rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: =
normal; font-variant: normal; font-weight: normal; letter-spacing: =
normal; line-height: normal; text-align: auto; =
-khtml-text-decorations-in-effect: none; text-indent: 0px; =
-apple-text-size-adjust: auto; text-transform: none; orphans: 2; =
white-space: normal; widows: 2; word-spacing: 0px; "><DIV>Lars =
Heidieker</DIV><DIV><A =
href=3D"mailto:lars@heidieker.de">lars@heidieker.de</A></DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>---</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV>Mystische Erkl=E4rungen.<DIV>Die =
mystischen Erkl=E4rungen gelten f=FCr tief;</DIV><DIV>die Wahrheit ist, =
dass sie noch nicht einmal oberfl=E4chlich sind.</DIV><DIV>=A0 =A0 =A0-- =
Friedrich Nietzsche</DIV><BR class=3D"Apple-interchange-newline"></SPAN> =
</DIV><BR></DIV></BODY></HTML>=

--Apple-Mail-1-113679886--