diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 1d88fd98acec..f3e4b6cbd32e 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -194,23 +194,20 @@ vm_object_zinit(void *mem, int size, int flags) vm_object_t object; object = (vm_object_t)mem; + bzero(&object->mtx, sizeof(object->mtx)); + mtx_init(&object->mtx, "vm object", NULL, MTX_DEF | MTX_DUPOK); /* These are true for any object that has been freed */ object->paging_in_progress = 0; object->resident_page_count = 0; object->shadow_count = 0; - - /* It relies on vm object mutex to be initialized afterwards. */ return (0); } static void -_vm_object_allocate(objtype_t type, vm_pindex_t size, vm_object_t object, - const char *mtxname) +_vm_object_allocate(objtype_t type, vm_pindex_t size, vm_object_t object) { - bzero(&object->mtx, sizeof(object->mtx)); - mtx_init(&object->mtx, "vm object", mtxname, MTX_DEF | MTX_DUPOK); TAILQ_INIT(&object->memq); LIST_INIT(&object->shadow_head); @@ -270,15 +267,17 @@ vm_object_init(void) TAILQ_INIT(&vm_object_list); mtx_init(&vm_object_list_mtx, "vm object_list", NULL, MTX_DEF); + mtx_init(&kernel_object->mtx, "vm object", "kernel object", MTX_DEF); _vm_object_allocate(OBJT_PHYS, OFF_TO_IDX(VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS), - kernel_object, "kernel object"); + kernel_object); #if VM_NRESERVLEVEL > 0 kernel_object->flags |= OBJ_COLORED; kernel_object->pg_color = (u_short)atop(VM_MIN_KERNEL_ADDRESS); #endif + mtx_init(&kmem_object->mtx, "vm object", "kmem object", MTX_DEF); _vm_object_allocate(OBJT_PHYS, OFF_TO_IDX(VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS), - kmem_object, "kmem object"); + kmem_object); #if VM_NRESERVLEVEL > 0 kmem_object->flags |= OBJ_COLORED; kmem_object->pg_color = (u_short)atop(VM_MIN_KERNEL_ADDRESS); @@ -404,7 +403,7 @@ vm_object_allocate(objtype_t type, vm_pindex_t size) vm_object_t object; object = (vm_object_t)uma_zalloc(obj_zone, M_WAITOK); - _vm_object_allocate(type, size, object, NULL); + _vm_object_allocate(type, size, object); return (object); }