svn commit: r247788 - head/sys/vm

Attilio Rao attilio at FreeBSD.org
Mon Mar 4 13:11:00 UTC 2013


Author: attilio
Date: Mon Mar  4 13:10:59 2013
New Revision: 247788
URL: http://svnweb.freebsd.org/changeset/base/247788

Log:
  Merge from vmcontention:
  As vm objects are type-stable there is no need to initialize the
  resident splay tree pointer and the cache splay tree pointer in
  _vm_object_allocate() but this could be done in the init UMA zone
  handler.
  
  The destructor UMA zone handler, will further check if the condition is
  retained at every destruction and catch for bugs.
  
  Sponsored by:	EMC / Isilon storage division
  Submitted by:	alc

Modified:
  head/sys/vm/vm_object.c

Modified: head/sys/vm/vm_object.c
==============================================================================
--- head/sys/vm/vm_object.c	Mon Mar  4 12:48:41 2013	(r247787)
+++ head/sys/vm/vm_object.c	Mon Mar  4 13:10:59 2013	(r247788)
@@ -165,8 +165,9 @@ vm_object_zdtor(void *mem, int size, voi
 
 	object = (vm_object_t)mem;
 	KASSERT(TAILQ_EMPTY(&object->memq),
-	    ("object %p has resident pages",
-	    object));
+	    ("object %p has resident pages in its memq", object));
+	KASSERT(object->root == NULL,
+	    ("object %p has resident pages in its tree", object));
 #if VM_NRESERVLEVEL > 0
 	KASSERT(LIST_EMPTY(&object->rvq),
 	    ("object %p has reservations",
@@ -197,9 +198,11 @@ vm_object_zinit(void *mem, int size, int
 	mtx_init(&object->mtx, "vm object", NULL, MTX_DEF | MTX_DUPOK);
 
 	/* These are true for any object that has been freed */
+	object->root = NULL;
 	object->paging_in_progress = 0;
 	object->resident_page_count = 0;
 	object->shadow_count = 0;
+	object->cache = NULL;
 	return (0);
 }
 
@@ -210,7 +213,6 @@ _vm_object_allocate(objtype_t type, vm_p
 	TAILQ_INIT(&object->memq);
 	LIST_INIT(&object->shadow_head);
 
-	object->root = NULL;
 	object->type = type;
 	switch (type) {
 	case OBJT_DEAD:
@@ -247,7 +249,6 @@ _vm_object_allocate(objtype_t type, vm_p
 #if VM_NRESERVLEVEL > 0
 	LIST_INIT(&object->rvq);
 #endif
-	object->cache = NULL;
 
 	mtx_lock(&vm_object_list_mtx);
 	TAILQ_INSERT_TAIL(&vm_object_list, object, object_list);


More information about the svn-src-all mailing list