summaryrefslogtreecommitdiffstats
path: root/sys/vm
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2011-11-04 04:41:58 +0000
committeralc <alc@FreeBSD.org>2011-11-04 04:41:58 +0000
commit89a58426002cd23bbf83a235e339744cb74fe3ac (patch)
tree875d300ec2939748834cf525568fe0f4c41417d0 /sys/vm
parent767a02dc14b492f8c777383ac774c12ccd3080ad (diff)
downloadFreeBSD-src-89a58426002cd23bbf83a235e339744cb74fe3ac.zip
FreeBSD-src-89a58426002cd23bbf83a235e339744cb74fe3ac.tar.gz
Simplify the implementation of the failure case in kmem_alloc_attr().
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vm_contig.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/sys/vm/vm_contig.c b/sys/vm/vm_contig.c
index 81fe6a5..50f95a5 100644
--- a/sys/vm/vm_contig.c
+++ b/sys/vm/vm_contig.c
@@ -258,8 +258,8 @@ kmem_alloc_attr(vm_map_t map, vm_size_t size, int flags, vm_paddr_t low,
retry:
m = vm_phys_alloc_contig(1, low, high, PAGE_SIZE, 0);
if (m == NULL) {
+ VM_OBJECT_UNLOCK(object);
if (tries < ((flags & M_NOWAIT) != 0 ? 1 : 3)) {
- VM_OBJECT_UNLOCK(object);
vm_map_unlock(map);
vm_contig_grow_cache(tries, low, high);
vm_map_lock(map);
@@ -267,13 +267,12 @@ retry:
tries++;
goto retry;
}
- while (i != 0) {
- i -= PAGE_SIZE;
- m = vm_page_lookup(object, OFF_TO_IDX(offset +
- i));
- vm_page_free(m);
- }
- VM_OBJECT_UNLOCK(object);
+ /*
+ * Since the pages that were allocated by any previous
+ * iterations of this loop are not busy, they can be
+ * freed by vm_object_page_remove(), which is called
+ * by vm_map_delete().
+ */
vm_map_delete(map, addr, addr + size);
vm_map_unlock(map);
return (0);
OpenPOWER on IntegriCloud