Correct two optimization errors in vm_object_page_remove:
1. The size of vm_object::memq is vm_object::resident_page_count, not vm_object::size. 2. The "size > 4" test sometimes results in the traversal of a ~1000 page memq in order to locate ~10 pages.
This commit is contained in:
parent
61a6296116
commit
aa8bb4e29a
@ -61,7 +61,7 @@
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*
|
||||
* $Id: vm_object.c,v 1.151 1999/02/15 02:03:40 dillon Exp $
|
||||
* $Id: vm_object.c,v 1.152 1999/02/24 21:26:26 dillon Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -1346,7 +1346,8 @@ vm_object_page_remove(object, start, end, clean_only)
|
||||
unsigned int size;
|
||||
int all;
|
||||
|
||||
if (object == NULL)
|
||||
if (object == NULL ||
|
||||
object->resident_page_count == 0)
|
||||
return;
|
||||
|
||||
all = ((end == 0) && (start == 0));
|
||||
@ -1354,7 +1355,7 @@ vm_object_page_remove(object, start, end, clean_only)
|
||||
vm_object_pip_add(object, 1);
|
||||
again:
|
||||
size = end - start;
|
||||
if (all || size > 4 || size >= object->size / 4) {
|
||||
if (all || size > object->resident_page_count / 4) {
|
||||
for (p = TAILQ_FIRST(&object->memq); p != NULL; p = next) {
|
||||
next = TAILQ_NEXT(p, listq);
|
||||
if (all || ((start <= p->pindex) && (p->pindex < end))) {
|
||||
|
Loading…
Reference in New Issue
Block a user