Re: Addendum to Daniel Phillips [RFC] use-once patch

Steven Walter
2001-07-28T02:15:54Z

On Fri, Jul 27, 2001 at 04:38:18PM +0200, Daniel Phillips wrote:
> > may be
> > + * it is the best candidate for swapping.
> > + */
> > + if ((page->age > PAGE_AGE_MAX) && (page_count(page)
> > <= 1)) {
> > + page->age = PAGE_AGE_START;
> > + } else {
> > + page->age += PAGE_AGE_ADV;
> > + if (page->age > PAGE_AGE_MAX) {
> > + page->age = PAGE_AGE_MAX;
> > + }
> > + return;
> > + }
>
> I noticed your good benchmark results below, but I'm having some
> trouble understanding how this works. How can page->age ever become
> greater than PAGE_AGE_MAX? Also, I don't see any reference to
> PAGE_MAX_USE. Comments?

What if page->age is equal to PAGE_AGE_MAX when it hits the 'else'
statement. It will be unconditionally incremented by PAGE_AGE_ADV, and
then it will be greater than PAGE_AGE_MAX. The inner 'if' statement
catches this, and sets the age back to PAGE_AGE_MAX
--
-Steven
In a time of universal deceit, telling the truth is a revolutionary act.
-- George Orwell