Subject: Re: (vm.filemax issue) -- Re: UBC on a no swap system
To: None <>
From: David Maxwell <>
List: tech-kern
Date: 06/18/2003 22:09:26
On Wed, Jun 18, 2003 at 07:29:42PM -0400, wrote:
> It doesn't look like vm.filemax has any effect on limiting
> the file system pages cached in the VM page cache.
> (I can't find any code anywhere that uses this
> to limit the size of the cache).
> Is this true and/or yet to be implemented?

I haven't dug into the depths of UVM, but I think the significant code
is this:

 * uvmpd_scan_inactive: scan an inactive list for pages to clean or
 * => called with page queues locked
 * => we work on meeting our free target by converting inactive pages
 *    into free pages.
 * => we handle the building of swap-backed clusters
 * => we return TRUE if we are exiting because we met our target  


Someone with more UVM knowledge can speak up and correct me, but from a
quick inspection, I'd say the logic is -

You can't refuse to allocate a page when asked for one - otherwise
programs can't load, files can't be read...

So, what you do is, when you're reactivating or freeing pages, you
prefer to reactivate pages in categories that are below their minumum,
and free pages in other categories (if you're beyond the watermark for
the number of pages you try to maintain free - freetarg, which is 4/3 of
freemin, which is 16k pages <= npages/20 <= 256k pages). If a category
is over it's target, you start by recovering pages in other categories
and then free (from the cat that's over) down to your watermark.

So, _max_ isn't a hard maximum - That could cause some memory to never
get used - instead it's a 'discard this first' marker for when space
gets tight.

There are probably applications where a hard maximum could be useful -
but I'm not sure how you do that without breaking the 'programs can't
load' etc, above. Force a scan for pages to free in that category when
the request comes in? Then what do you do if there are no inactive

David Maxwell,| --> Mastery of UNIX, like
mastery of language, offers real freedom. The price of freedom is always dear,
but there's no substitute. Personally, I'd rather pay for my freedom than live
in a bitmapped, pop-up-happy dungeon like NT. - Thomas Scoville