Subject: Re: UBC usage-balancing code is checked in.
To: Hubert Feyrer <>
From: Chuck Silvers <>
List: tech-kern
Date: 03/09/2001 08:19:34
On Fri, Mar 09, 2001 at 12:57:55PM +0100, Hubert Feyrer wrote:
> On Thu, 8 Mar 2001, it was written:
> >   add UBC memory-usage balancing.  we track the number of pages in use for
> >   each of the basic types (anonymous data, executable image, cached files)
> >   and prevent the pagedaemon from reusing a given page if that would reduce
> >   the count of that type of page below a sysctl-setable minimum threshold.
> >   the thresholds are controlled via three new sysctl tunables:
> >   vm.anonmin, vm.vnodemin, and vm.vtextmin.  these tunables are the
> >   percentages of pageable memory reserved for each usage, and we do not allow
> >   the sum of the minimums to be more than 95% so that there's always some
> >   memory that can be reused.
> So do I understand this right:
> To make sure my heavily-used apps are not paged out, I'd go and add up
> their memory footprint (op SIZE column?), and use that as vm.vtextmin?

well, it's a bit more complicated than that.  vm.vtextmin controls pages
which contain cached file data from files that are currently in use as
a process's executable image.  this would be files like /sbin/init,
/usr/sbin/syslogd, things like that.  note that it does not include
pages from shared libraries, since those are currently accounted as
plain file data.  vm.anonmin controls pages which contain application
anonymous memory, including memory obtained via malloc() as well as pages
from the executable's data segment which have been modified (since modifying
these file pages creates a private copy for a process).

so what you'd want to do is set both vm.anonmin and vm.vtextmin to be
"large enough".  for most applications, there won't be all that many
vtext pages so vm.vtextmin will probable be big enough already.  to get
a number for vm.anonmin, add up the "RSS" numbers from ps for the processes
you care about and divide that by the total amount of RAM in the machine
to get the percentage to set.