Subject: RE: memory allocation question
To: Tim Underwood <TimU@hightouchinc.com>
From: Noriyuki Soda <soda@sra.co.jp>
List: port-hpcmips
Date: 08/12/2004 04:25:39
>>>>> On Wed, 11 Aug 2004 13:45:38 -0500,
	"Tim Underwood" <TimU@hightouchinc.com> said:

>> But this setting affects only when free memory isn't enough.
>> File cache grows as far as there is enough free memory.

>> If memory shortage happens, and if Exec pages or Anon page=20
>> need more memory, File pages will be reclaimed and the pages=20
>> will be used for Exec pages or Anon pages.

Well, it seems my description leads your misunderstandings.
The above description only applies if the size of File pages reaches
vm.filemax, and the size of Exec pages and Anon pages don't reach
vm.execmax and vm.anonmax. Sorry for that I didn't clarify this.
So...

> So, if I understand you correctly, memory will always be reclaimed from
> the file cache, as needed?  No matter what the min/max settings are?
> And will that memory always be reclaimed prior to using swap?

No, that's not right.

The sysctl variables vm.{file,exec,anon}{min,max} are used to
determine how memory is reclaimed, as follows:

When memory shortage happens, and 
- if a region ${A} (${A} is either file, exec or anon) is smaller than
  ${A}min, entire space of the region ${A} is considered active, so
  memory is reclaimed from regions other than ${A}.
- if region ${A} is smaller than ${A}max, and if there is a region
  ${B} where the size of ${B} is larger than ${B}max, then
  entire space of the region ${A} is considered active, so memory
  is reclaimed from regions other than ${A}.

This is why larger value of vm.filemin and vm.filemax is not good
for interactive use.
BTW, the unit of vm.{file,exec,anon}{min,max} is percentage.
--
soda