Subject: more infos about UVM
To: None <email@example.com>
From: Joel CARNAT <firstname.lastname@example.org>
Date: 11/06/2006 01:14:23
Doing some rddtool stuff, I started looking at how memory management is
done on NetBSD. The trouble is I seem to not understand everything. Here
are the points I would like explanations for:
The difference between "total memory" and "avail memory" is the kernel
size. But my values don't match :
# dmesg | grep memory
total memory = 188 MB
avail memory = 184 MB
# ll /netbsd
-rwxr-xr-x 1 root wheel 3.0M Apr 22 2006 /netbsd*
What is the 1MB missing used for ? This difference is there on my 4 /xen
dom0/domU and /sparc64. Is this because of something like "to store a
3MB kernel in memory, you need an additional 1MB for data structure" ?
Getting "free" memory is OK (from top and vmstat), but I have issue
guessing how the used memory is split. As far as I understood the docs
("NetBSD Documentation: UVM, the new Virtual Memory system" and inside
links, "Memory Management in Mac OS X", googling for "UVM" and "wired
memory"), the "used" memory should be Active+Inactive+Wired. The "Exec"
and "File" parts can be split in any of the 3 previous memory parts.
But if I sum up Active+Inactive+Wired (from top), I don't get the same
value as vmstat.avm*hw.pagesize (converted to MB). Depending on the
machine I take the values from, the difference can go from a few MB to
150MB. The swap is empty so the difference is not there.
I've checked a few source things (top, vmstat, phpsysinfo, hobbitclient)
but couldn't find how to get how "used" memory is splitted.
If I check my MacOSX workstation Active+Inactive+Wired=Used.
Is there a magic math formula to get the full "used" memory repartition ?