Subject: Re: UBC, interactive performance, etc
To: None <fvdl@wasabisystems.com, jdolecek@netbsd.org>
From: None <eeh@netbsd.org>
List: tech-kern
Date: 04/03/2001 17:48:05
	I'd probably preferred if the buffer cache would not touch text&data
	pages at all. In other words, that buffer cache would only use
	free, otherwise unused memory. It seems highly suboptimal for the page
	scanner to kick processes' data/text pages out of memory just to make
	more room for i/o buffers.

There always seems to be some confusion here.  There is no `free, otherwise 
unused memory' and the buffer cache guarantees that.

Pre-UBC, the buffer cache had a dedicated set of pages, ISTR it was
somewhere around 5% of RAM.  If the buffer cache needed a page it would
have to evict another buffer cache entry.  If something else needed a
page it would have to evict something other than a buffer cache page.
In that configuration, you sometimes had free pages (above the free
page requirement) because the buffer cache couldn't use them and either
a large process terminated and freed them or nothing else needed them.

With UBC, the buffer cache competes for pages with everything else.  
And the buffer cache is always hungry.  Whenever you do an I/O operation
the buffer cache will consume a page, and the buffer cache never frees
pages the way exiting processes do.  They need to be stolen.  And (at
least before Chuq's latest performance patch) all pages compete equally.
Since the buffer cache is in use, those pages are more recent, thus less
likely to be reclaimed than other pages that have not been used as recently.

	I think there should be some minimal value of memory dedicated to
	buffer cache (i.e. what BUFCACHE/BUFPAGES does) and more memory
	would only be used if it's otherwise _unused at all_.
	Perhaps this might be an option, but such behaviour should be default IMHO.

That's pretty much what the patch I sent out some time ago does, but it
limits the buffer cache to inactive limit.  You can always give it a try.

Chuq's performance patch, as I understand it, tries to insure the system
retains a minimum number of pages of a specific type.  I prefer to try
something that tries to predict the likelyhood of reuse rather than put
restrictions on the number of pages of any particular type in use.

But, in any case, with UBC you will never have pages that are
`_unused at all_' if the machine has been up for any length of time
because they will all be eaten by the buffer cache.  We could solve
this by reclaiming directly from the buffer cache.  But if we do this
we will always be using the same 5 pages for the buffer cache and it 
will never grow large enough to hold useful amounts of data.  Catch
22.

Eduardo