Subject: pmap_is_referenced() -- not used?
To: None <tech-kern@netbsd.org>
From: Jason R Thorpe <thorpej@zembu.com>
List: tech-kern
Date: 01/24/2001 11:53:07
So I was looking through UVM today, and noticed that pmap_is_referenced()
is no longer used -- at all. This appears to have happened with UBC,
to some extent.
It looks like, in general, the pagedaemon is a lot less efficient that it
could be (and, in fact, *used* to be).
In my mind, this is how it SHOULD work:
for (pg on inactive list) {
if (free target is met)
break;
if (pg is referenced) {
/* DO NOT CLEAR REFERENCE! */
move page to active list;
}
pmap_page_protect(pg, VM_PROT_NONE);
if (pg is modified)
start a clean of the page;
else if (page is clean)
free page;
}
for (pg on active list) {
if (inactive target is met) {
/*
* HAVE TO RETHINK THIS IF UBC CACHE PAGES ARE
* PLACED ONTO THE INACTIVE LIST (causing a glut
* of inactive pages).
*/
break;
}
if (pg is referenced)
clear reference;
else {
/* NOTE: PAGE IS NOT PROTECTED IN ANY WAY! */
move page to inactive list;
}
}
Note in this scheme that moving pages between the active and inactive
lists is very cheap -- it does not involve pmap_page_protect()'ing
the page with VM_PROT_NONE to move it to the inactive list, and simply
uses the "page is referenced" statistic from the pmap module (if a pmap
doesn't implement referenced info, well, that's a bug -- fix the pmap
so that performance doesn't suck -- but it *HAS* to implement modified
info).
Note that in this scheme, you can also keep a bunch of pages on the
inactive list and it doesn't matter, since the list isn't scanned if
the free target is met -- and over time, esp. if you don't bother with
an "inactive target", you can reduce greatly reduce the amount of work
done by the pagedaemon by having pages move off to the inactive list and
just sit there, being used as normal, only having to move back to "active"
if suddently there isn't enough free memory.
--
-- Jason R. Thorpe <thorpej@zembu.com>