diff options
author | jeff <jeff@FreeBSD.org> | 2013-06-28 03:51:20 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2013-06-28 03:51:20 +0000 |
commit | e725dd5c1ef985f6374f7a36ebdaaf10964b0131 (patch) | |
tree | 1ec9ab556a4e03f63542c71cdcc9e56ac39f7ef0 /sys/geom | |
parent | 5aabb39c86af06392b2155209b47c6511f6f8167 (diff) | |
download | FreeBSD-src-e725dd5c1ef985f6374f7a36ebdaaf10964b0131.zip FreeBSD-src-e725dd5c1ef985f6374f7a36ebdaaf10964b0131.tar.gz |
- Add a general purpose resource allocator, vmem, from NetBSD. It was
originally inspired by the Solaris vmem detailed in the proceedings
of usenix 2001. The NetBSD version was heavily refactored for bugs
and simplicity.
- Use this resource allocator to allocate the buffer and transient maps.
Buffer cache defrags are reduced by 25% when used by filesystems with
mixed block sizes. Ultimately this may permit dynamic buffer cache
sizing on low KVA machines.
Discussed with: alc, kib, attilio
Tested by: pho
Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'sys/geom')
-rw-r--r-- | sys/geom/geom_io.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/sys/geom/geom_io.c b/sys/geom/geom_io.c index 25a90de..0e79920 100644 --- a/sys/geom/geom_io.c +++ b/sys/geom/geom_io.c @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include <sys/proc.h> #include <sys/stack.h> #include <sys/sysctl.h> +#include <sys/vmem.h> #include <sys/errno.h> #include <geom/geom.h> @@ -626,7 +627,6 @@ g_io_transient_map_bio(struct bio *bp) vm_offset_t addr; long size; u_int retried; - int rv; KASSERT(unmapped_buf_allowed, ("unmapped disabled")); @@ -636,10 +636,7 @@ g_io_transient_map_bio(struct bio *bp) retried = 0; atomic_add_long(&transient_maps, 1); retry: - vm_map_lock(bio_transient_map); - if (vm_map_findspace(bio_transient_map, vm_map_min(bio_transient_map), - size, &addr)) { - vm_map_unlock(bio_transient_map); + if (vmem_alloc(transient_arena, size, M_BESTFIT | M_NOWAIT, &addr)) { if (transient_map_retries != 0 && retried >= transient_map_retries) { g_io_deliver(bp, EDEADLK/* XXXKIB */); @@ -651,7 +648,7 @@ retry: /* * Naive attempt to quisce the I/O to get more * in-flight requests completed and defragment - * the bio_transient_map. + * the transient_arena. */ CTR3(KTR_GEOM, "g_down retrymap bp %p provider %s r %d", bp, bp->bio_to->name, retried); @@ -661,12 +658,6 @@ retry: goto retry; } } - rv = vm_map_insert(bio_transient_map, NULL, 0, addr, addr + size, - VM_PROT_RW, VM_PROT_RW, MAP_NOFAULT); - KASSERT(rv == KERN_SUCCESS, - ("vm_map_insert(bio_transient_map) rv %d %jx %lx", - rv, (uintmax_t)addr, size)); - vm_map_unlock(bio_transient_map); atomic_add_int(&inflight_transient_maps, 1); pmap_qenter((vm_offset_t)addr, bp->bio_ma, OFF_TO_IDX(size)); bp->bio_data = (caddr_t)addr + bp->bio_ma_offset; |