SunSolve Internal

Infodoc ID   Synopsis   Date
14136   kernel tips: Why does vmstat show so little free memory ?   17 Apr 1997

Description Top

Question: Why does vmstat show so little free memory?  Is it depleted?

Answer:

What the vmstat "free memory" column represents:

The vmstat free memory column and the sar -r "freemem" column indicate the
size of the freelist, which is a list of pages which have been marked free by
the page daemon.  This, however, is a misleading figure.  Only anonymous pages
are put on the free list automatically (i.e. when a process exits).  Anonymous
pages are those pages which have no file identity.  Examples of anonymous
pages would be process stack and data.  Examples of pages which have an
identity are pages from an executable (that is the actual code) and
data read from files.

The system attempts to maintain in memory cache all pages which have an
identity (if it was just used, it's apt to be needed again in the near
future).  Think of how many times the pages for ls (or pick some other
favorite command) would have to be read from memory if the system didn't
do this.

However, even though pages with an identity don't show up on the free
list, they are still available to be assigned to some process that needs
the memory.  So a system actually has more memory available for use than
what is shown in the "freemem" column.

The size of the freelist will appear to shrink to a very small value
(determined by the tunable parameter "lotsfree"), and will remain at that
value.  The page daemon will kick in and look for more memory to reclaim from
exited and idle processes when the amount on the freelist drops below this
threshold.  There is no way for the value to grow much above the threshold,
because there is no way to get the page daemon to work to reclaim memory
beyond the threshold.

What all of this means, is that the size of the freelist is no indication of
how much free memory there really is, because there may be a great amount of
unused memory which has yet to be reclaimed by the page daemon, because the
page daemon has no need to reclaim it.

A better way to tell if a system is short of memory:

Take a look at the "sr" column of vmstat, or the sar -g "pagescan" value.
This indicates how quickly the page daemon is looking to find unused memory
pages to reclaim for use by needy processes (in units of pages per second).
The higher the value, the more desperate the system is to find the memory.
When there is no memory shortage, this value will sit at zero.  When new
processes first start up, this value may jump and then return to zero.  It may
be a steady small value, which indicates that the system page daemon is active
all the time;  this may be OK but it does indicate that the system does not
have adequate memory to run without paging.  The experts say that if this
value is steadily over 200, then more memory is definitely needed.

For more information:

Please see chapter 11 of the "Sun Performance and Tuning" book by Adrian
Cockcroft (1995, SunSoft Press) for more information on how paging and memory
management works, and for information on how to tune memory parameters for
optimal performance.
Product Area Kernel
Product general
OS Solaris 2.x
Hardware any

Top

SunWeb Home SunWeb Search SunSolve Home Simple Search

Sun Proprietary/Confidential: Internal Use Only
Feedback to SunSolve Team