summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2004-01-01 19:48:56 +0000
committeralc <alc@FreeBSD.org>2004-01-01 19:48:56 +0000
commit2548f7af855cba21e6ce5adabf2e61189afadd42 (patch)
tree56397c4596e721c2c4040ee7981871dc6f8d992c /sys
parentbbd000ecddcd2ee2a48b8105d8c584459a03f6d5 (diff)
downloadFreeBSD-src-2548f7af855cba21e6ce5adabf2e61189afadd42.zip
FreeBSD-src-2548f7af855cba21e6ce5adabf2e61189afadd42.tar.gz
- Increase the scope of the kmem_object's lock in kmem_malloc(). Add a
comment explaining why a further increase is not possible.
Diffstat (limited to 'sys')
-rw-r--r--sys/vm/vm_kern.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c
index d170af3..4f6b984 100644
--- a/sys/vm/vm_kern.c
+++ b/sys/vm/vm_kern.c
@@ -424,6 +424,11 @@ retry:
panic("kmem_malloc: entry not found or misaligned");
entry->wired_count = 1;
+ /*
+ * At this point, the kmem_object must be unlocked because
+ * vm_map_simplify_entry() calls vm_object_deallocate(), which
+ * locks the kmem_object.
+ */
vm_map_simplify_entry(map, entry);
/*
@@ -431,10 +436,9 @@ retry:
* the wired count without wrapping the vm_page_queue_lock in
* splimp...)
*/
+ VM_OBJECT_LOCK(kmem_object);
for (i = 0; i < size; i += PAGE_SIZE) {
- VM_OBJECT_LOCK(kmem_object);
m = vm_page_lookup(kmem_object, OFF_TO_IDX(offset + i));
- VM_OBJECT_UNLOCK(kmem_object);
/*
* Because this is kernel_pmap, this call will not block.
*/
@@ -444,6 +448,7 @@ retry:
vm_page_wakeup(m);
vm_page_unlock_queues();
}
+ VM_OBJECT_UNLOCK(kmem_object);
vm_map_unlock(map);
return (addr);
OpenPOWER on IntegriCloud