Subject: pagescanner
To: None <tech-kern@netbsd.org, thorpej@zembu.com, chuq@chuq.com>
From: Lars Heidieker <lars@heidieker.de>
List: tech-kern
Date: 01/29/2001 21:58:41
Shalom,

after doing some invastigations....
I think my last patch was suboptimal (not to say bad) it favored anon
mem over vnode mem too much,
as vnode mem everything mapped from a file.

This is what the old mach-vm did (expressed in terms of uvm):

                if (inactive_shortage > 0) {
                        pmap_clear_reference(p);
                        /* no need to check wire_count as pg is "active"
*/
                        uvm_pagedeactivate(p);
                        uvmexp.pddeact++;
                        inactive_shortage--;
                }

This means that pages need to be referenced while being on the inactive
in order to get reactivated.

                if (inactive_shortage > 0 &&
                    pmap_clear_reference(p) == FALSE) {
                        /* no need to check wire_count as pg is "active"
*/
                        uvm_pagedeactivate(p);
                        uvmexp.pddeact++;
                        inactive_shortage--;
                }

Is the current code which leaves referenced pages on the active queue,
but still at the wrong place as

1->2->3->4->5->6->7->8->9->10->11->12->13->14->15->16->17

might be the active queue on scanning it the first time, as it is a fifo
queue the scanner starts with page 1
might find 3 and 7 referenced and meeting the inactive target at page
10.
This will result with in with the current code:

3->7->11->12->13->14->15->16->17-> + (other pages that became active)

and the scanner will start with page 3....

with moving referenced pages to the end of the active queue it will look
like this:

11->12->13->14->15->16->17->3->7-> + (other pages that became active)

and this will give 3 and 7 "more time" to get referenced again what
should be better.

Forget about about the other part of my patch.....

sincerely
lars