diff options
author | alc <alc@FreeBSD.org> | 2002-12-20 18:59:23 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2002-12-20 18:59:23 +0000 |
commit | cf1d112d8e94856cb07a9f7676e245454e0be679 (patch) | |
tree | 2bf1355f14df4ab983c3c7b57fa9b23199678c91 /sys/vm | |
parent | 1ce25ddc405257e6eb1d28375e9ad2f3019c6be3 (diff) | |
download | FreeBSD-src-cf1d112d8e94856cb07a9f7676e245454e0be679.zip FreeBSD-src-cf1d112d8e94856cb07a9f7676e245454e0be679.tar.gz |
Increase the scope of the kmem_object locking in kmem_malloc().
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/vm_kern.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c index 2596e1d..3701082 100644 --- a/sys/vm/vm_kern.c +++ b/sys/vm/vm_kern.c @@ -359,7 +359,7 @@ kmem_malloc(map, size, flags) if (flags & M_ZERO) pflags |= VM_ALLOC_ZERO; - + vm_object_lock(kmem_object); for (i = 0; i < size; i += PAGE_SIZE) { retry: m = vm_page_alloc(kmem_object, OFF_TO_IDX(offset + i), pflags); @@ -371,9 +371,11 @@ retry: */ if (m == NULL) { if ((flags & M_NOWAIT) == 0) { + vm_object_unlock(kmem_object); vm_map_unlock(map); VM_WAIT; vm_map_lock(map); + vm_object_lock(kmem_object); goto retry; } /* @@ -384,14 +386,13 @@ retry: */ while (i != 0) { i -= PAGE_SIZE; - vm_object_lock(kmem_object); m = vm_page_lookup(kmem_object, OFF_TO_IDX(offset + i)); vm_page_lock_queues(); vm_page_free(m); vm_page_unlock_queues(); - vm_object_unlock(kmem_object); } + vm_object_unlock(kmem_object); vm_map_delete(map, addr, addr + size); vm_map_unlock(map); goto bad; @@ -401,6 +402,7 @@ retry: vm_page_flag_clear(m, PG_ZERO); m->valid = VM_PAGE_BITS_ALL; } + vm_object_unlock(kmem_object); /* * Mark map entry as non-pageable. Assert: vm_map_insert() will never |