Subject: Re: Memory totals under top on 1.6_BETA
To: Chris Gilbert <chris@paradox.demon.co.uk>
From: David Brownlee <abs@netbsd.org>
List: current-users
Date: 07/29/2002 11:07:38
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.
--=-os2hku7R8a7DxKJ6RRuZ
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
Content-ID: <Pine.NEB.4.44.0207291049012.380@moss.i.formula1.com>
On 28 Jul 2002, Chris Gilbert wrote:
> On Thu, 2002-07-25 at 16:25, David Brownlee wrote:
> > Machine has 1GB of RAM, top reports:
> >
> > Memory: 525M Act, 265M Inact, 2316K Wired, 7220K Exec, 635M File, 5056K Free
> >
> > Ading them all up gives 1439 MB.
> >
> > Act + Wired + Exec + File + Free = 1174 MB
> >
> > Am I missing something?
>
> yes top doesn't show all the numbers, the groupings should be:
> Act + Inact + Wired + Free (missing pages to be paged)
>
> and
> Exec + File (and missing some others, eg Anon, Zero pages, and Reserved
> pages, zero and reserved are near constant)
>
> Using the above you've got:
> 525 + 265 + 2.3 + 5 = 797.3, which is a couple of hundred less then
> expected (what does dmesg give as your total available?)
total memory = 1023 MB
avail memory = 945 MB
> or
> 7.2 + 635 = 642.5 again not quite there either, the missing chuck being
> anon pages normally.
>
> The other place to get figures is:
> vmstat -s
> but perhaps ain't as handy as top.
>
> If you're really interested try the attached patch. (you might want to
> trim the paging and reserved bits out though)
Thanks, with that I get:
Memory: 266M Act, 960K Inact, 2008K Wired, 647M Free, 161M Anon, 6336K
Exec, 131M File, 24K Rsvd
Swap: 2258M Total, 2258M Free
Act + Inact + Wired + Free = 916M
Exec + File + Anon + Rsvd + Wired + Inact + Free = 948MB
Would it make sense to put Anon etc on a second line in top?
Comparable output from vmstat -s (thanks! :)
# vmstat -s | grep pages | grep -v ' 0 '
257457 pages managed (1005M)
164361 pages free (642M)
69248 pages active (270M)
240 pages inactive
505 pages wired
1 reserve pagedaemon pages
5 reserve kernel pages
41298 anonymous pages (161M)
34676 cached file pages (135M)
1584 cached executable pages (6M)
64 minimum free pages
85 target free pages
85819 maximum wired pages
577998 swap pages
--
David/absolute -- www.netbsd.org: No hype required --
--=-os2hku7R8a7DxKJ6RRuZ
Content-Type: TEXT/PLAIN; NAME="top.diff"; CHARSET=ISO-8859-15
Content-Transfer-Encoding: QUOTED-PRINTABLE
Content-ID: <Pine.NEB.4.44.0207291049013.380@moss.i.formula1.com>
Content-Description:
Content-Disposition: ATTACHMENT; FILENAME="top.diff"
? sigdesc.h
? machine/.m_netbsd15.c.swp
Index: machine/m_netbsd15.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/basesrc/usr.bin/top/machine/m_netbsd15.c,v
retrieving revision 1.16
diff -u -p -r1.16 m_netbsd15.c
--- machine/m_netbsd15.c 2002/03/23 01:28:11 1.16
+++ machine/m_netbsd15.c 2002/07/28 20:43:36
@@ -135,10 +135,10 @@ char *cpustatenames[] =3D {
=20
/* these are for detailing the memory statistics */
=20
-int memory_stats[7];
+int memory_stats[10];
char *memorynames[] =3D {
- "K Act, ", "K Inact, ", "K Wired, ", "K Exec, ", "K File, ",
- "K Free, ",
+ "K Act, ", "K Inact, ", "K Wired, ", "K Paging, ", "K Free, ",
+ "K Anon, ", "K Exec, ", "K File, ", "K Rsvd, ",
NULL
};
=20
@@ -314,9 +314,13 @@ get_system_info(si)
memory_stats[0] =3D pagetok(uvmexp.active);
memory_stats[1] =3D pagetok(uvmexp.inactive);
memory_stats[2] =3D pagetok(uvmexp.wired);
- memory_stats[3] =3D pagetok(uvmexp.execpages);
- memory_stats[4] =3D pagetok(uvmexp.filepages);
- memory_stats[5] =3D pagetok(uvmexp.free);
+ memory_stats[3] =3D pagetok(uvmexp.paging);
+ memory_stats[4] =3D pagetok(uvmexp.free);
+ memory_stats[5] =3D pagetok(uvmexp.anonpages);
+ memory_stats[6] =3D pagetok(uvmexp.execpages);
+ memory_stats[7] =3D pagetok(uvmexp.filepages);
+ memory_stats[8] =3D pagetok(uvmexp.zeropages +
+ uvmexp.reserve_pagedaemon + uvmexp.reserve_kernel);
=20
swap_stats[0] =3D swap_stats[1] =3D swap_stats[2] =3D 0;
=20
@@ -361,7 +365,7 @@ get_system_info(si)
if (seporig)
free(seporig);
=20
- memory_stats[6] =3D -1;
+ memory_stats[9] =3D -1;
swap_stats[3] =3D -1;
=20
/* set arrays and strings */
--=-os2hku7R8a7DxKJ6RRuZ--