changeset 10543:3e3d2b81ed8e

6862616 assertion failed: (*last)->vmb_type != VMUSAGE_BOUND_UNKNOWN
author Peter Telford <Peter.Telford@Sun.COM>
date Tue, 15 Sep 2009 03:36:15 -0700
parents ef3706982293
children b484cf5fe72f
files usr/src/uts/common/vm/vm_usage.c
diffstat 1 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/vm/vm_usage.c	Tue Sep 15 03:38:42 2009 -0600
+++ b/usr/src/uts/common/vm/vm_usage.c	Tue Sep 15 03:36:15 2009 -0700
@@ -743,6 +743,7 @@
 			tmp = vmu_alloc_bound();
 			tmp->vmb_start = (*last)->vmb_end + 1;
 			tmp->vmb_end = end;
+			tmp->vmb_type = type;
 			ret += tmp->vmb_end - tmp->vmb_start + 1;
 			avl_insert_here(tree, tmp, *last, AVL_AFTER);
 			*last = tmp;
@@ -753,6 +754,7 @@
 				tmp = vmu_alloc_bound();
 				tmp->vmb_start = (*last)->vmb_end + 1;
 				tmp->vmb_end = walker->vmb_start - 1;
+				tmp->vmb_type = type;
 				ret += tmp->vmb_end - tmp->vmb_start + 1;
 				avl_insert_here(tree, tmp, *last, AVL_AFTER);
 				*last = tmp;
@@ -849,8 +851,8 @@
 
 /*
  * Merges adjacent bounds with same type between first and last bound.
- * After merge, last pointer is no longer valid, as last bound may be
- * merged away.
+ * After merge, last pointer may point to a different bound, as (incoming)
+ * last bound may have been merged away.
  */
 static void
 vmu_merge_bounds(avl_tree_t *tree, vmu_bound_t **first, vmu_bound_t **last)
@@ -871,10 +873,11 @@
 			avl_remove(tree, next);
 			vmu_free_bound(next);
 			if (next == *last) {
-				break;
+				*last = current;
 			}
+		} else {
+			current = AVL_NEXT(tree, current);
 		}
-		current = AVL_NEXT(tree, current);
 	}
 }
 
@@ -1087,7 +1090,6 @@
 	vmu_object_t *entity_object = NULL;
 	vmu_entity_t *entity;
 	vmusage_t *result;
-	avl_tree_t *tree;
 	vmu_bound_t *first = NULL;
 	vmu_bound_t *last = NULL;
 	vmu_bound_t *cur = NULL;
@@ -1344,6 +1346,8 @@
 
 	/* Compute resident pages backing shared amp or named vnode */
 	if (shared_object != NULL) {
+		avl_tree_t *tree = &(shared_object->vmo_bounds);
+
 		if (first == NULL) {
 			/*
 			 * No private amp, or private amp has no anon
@@ -1366,7 +1370,6 @@
 			    cur->vmb_start, cur->vmb_end, VMUSAGE_BOUND_UNKNOWN,
 			    &first, &last) > 0) {
 				/* new bounds, find incore/not-incore */
-				tree = &(shared_object->vmo_bounds);
 				if (shared_object->vmo_type ==
 				    VMUSAGE_TYPE_VNODE) {
 					vmu_vnode_update_incore_bounds(