Subject: Re: page replacement
To: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
From: Chuck Silvers <chuq@chuq.com>
List: tech-kern
Date: 12/14/2005 20:37:16
On Wed, Dec 14, 2005 at 10:23:16PM +0900, YAMAMOTO Takashi wrote:
> hi,
> 
> > > - page type balancing is disabled for simplicity.
> > 
> > did having this enabled or disabled affect the results?
> 
> as it "randomize" the order of pages in page queue,
> results were somewhat unstable with it enabled, depends on amount of memory.
> 
> anyway, results with the default setting are here:
> 	vm.anonmin = 10 vm.execmin = 5 vm.filemin = 10
> 	vm.anonmax = 80 vm.execmax = 30 vm.filemax = 50
> ftp://ftp.netbsd.org/pub/NetBSD/misc/yamt/2/ld.ps.gz
> ftp://ftp.netbsd.org/pub/NetBSD/misc/yamt/2/ld_e.ps.gz
> ftp://ftp.netbsd.org/pub/NetBSD/misc/yamt/2/ld_b.ps.gz

interesting... it looks like clrref=0 sometimes does better than clrref=1
with the balancing stuff turned on.  so the interesting comparison would be
clrref=0 with balancing on vs. clrref=1 with balancing off.

(I'd really like to get rid of the balancing stuff if we can,
it's a horrible interface for tuning the system.)


> > I guess that the effect of clearing the reference bit when moving a page
> > from active to inactive is to discount the initial pages access the occurs
> > when a page is first create.  only if a page is accessed again after some
> > time would we consider it important enough to keep.  it's interesting that
> > the shorter you make the period of "initial access" (ie. the longer you make
> > the inactive queue), the better the result.  so my notion that gathering
> > access info for longer was right, I just forgot that it's important to ignore
> > the initial access.
> 
> yes, otherwise newly allocated pages are always reactivated once.
> it makes old pages hard to compete.

yea.  so it would likely be even better to maintain more than 2 bits of
access history info.  the current system has 4 states (the cross product
of active vs. inactive and referenced vs. not), and clrref=1 reduces this
to 3 states (active, inactive and referenced, inactive and not referenced).
various people have previously played around with the idea of having more
states that would reflect a page having reached the inactive-and-referenced
state more than once.  this would give such often-referenced pages an even
greater lifetime, with less interference from once-referenced pages.
you might try to construct a framework that would allow for experimentation
with different ways to use this additional access history information to
give preference to old pages.

-Chuck