diff options
author | alc <alc@FreeBSD.org> | 1999-03-14 06:36:00 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 1999-03-14 06:36:00 +0000 |
commit | aa8bb4e29a4095203d5a8e1b785b17a441f4903c (patch) | |
tree | 008d1ac0dd00653fcb97a57b3f8101f7b991f480 /sys/vm | |
parent | 61a6296116f7ce2e8d5fb9c66acef69bb228e0a7 (diff) | |
download | FreeBSD-src-aa8bb4e29a4095203d5a8e1b785b17a441f4903c.zip FreeBSD-src-aa8bb4e29a4095203d5a8e1b785b17a441f4903c.tar.gz |
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.
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/vm_object.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index ea3b49c..398e3de 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -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))) { |