kernel -- vm locking: Lock kernel_object in kmem_alloc3.
authorVenkatesh Srinivas <me@endeavour.zapto.org>
Wed, 16 Feb 2011 02:33:43 +0000 (18:33 -0800)
committerVenkatesh Srinivas <me@endeavour.zapto.org>
Wed, 16 Feb 2011 02:33:43 +0000 (18:33 -0800)
sys/vm/vm.h
sys/vm/vm_kern.c

index 67c2442..88e6370 100644 (file)
@@ -108,9 +108,6 @@ typedef struct vm_map *vm_map_t;
 struct vm_object;
 typedef struct vm_object *vm_object_t;
 
-struct vm_object_lock;
-typedef struct vm_object_lock *vm_object_lock_t;
-
 /*
  * This is also defined in vm/vm_page.h.
  */
index f8726e1..4bf0a14 100644 (file)
@@ -216,6 +216,7 @@ kmem_alloc3(vm_map_t map, vm_size_t size, int kmflags)
         * race with page-out.  vm_map_wire will wire the pages.
         */
        lwkt_gettoken(&vm_token);
+       vm_object_lock(&kernel_object);
        for (i = gstart; i < size; i += PAGE_SIZE) {
                vm_page_t mem;
 
@@ -227,6 +228,7 @@ kmem_alloc3(vm_map_t map, vm_size_t size, int kmflags)
                vm_page_flag_clear(mem, PG_ZERO);
                vm_page_wakeup(mem);
        }
+       vm_object_unlock(&kernel_object);
        lwkt_reltoken(&vm_token);
 
        /*