Subject: Memory page counting
To: None <netbsd-help@NetBSD.ORG>
From: Tom Pavel <pavel@MAILBOX.SLAC.Stanford.EDU>
List: netbsd-help
Date: 06/13/1995 21:57:48
I'm puzzled about the counting of memory pages.  This all started when
I built top 3.3.  It has a display which reads something like this on
my 8MB i486 machine:

	Memory: 2976K Act, 1492K Inact, 2084K Wired, 328K Free, 40% Swap

Now, I figured out that the active and inactive pages are the two
queues from the Mach "FIFO with a 2nd chance" paging algorithm.  They
come from cnt.v_active_count and cnt.v_inactive_count.  The "Wired"
pages comes from cnt.v_wire_count, and pretty much make sense as the
boot messages report 1432k used by the kernel plus 492k used by buffer
cache.  The "Free" number is sum.v_free_count.

Ok.  Sounds good.  But why do the numbers add up to 6880k and not 8MB?
What else occupies memory that does not go into one of these four
numbers?  [I'm running a -current kernel of last week's vintage.]

Oh, yeah.  Just to cross-check, I added vm.vmmeter to sysctl(8).  It
reports (t_rm + t_free) * 4k = 7040k, which is not exactly the same as
the cnt numbers, but is closer to that than to 8MB (7808k).  [BTW,
where should one send in such "enhancements"?]


Any ideas or pointers on this greatly appreciated,


Tom Pavel

Stanford Linear Accelerator Center
pavel@slac.stanford.edu