diff options
author | jhb <jhb@FreeBSD.org> | 2013-07-19 19:06:15 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2013-07-19 19:06:15 +0000 |
commit | d67e7a1cc9054fbcf546edfe5ebc03bb5e29d4ca (patch) | |
tree | 7777baf0c52b0b66567d2147e4ab8ed497fc8e3c /sys/vm/vm_map.c | |
parent | 7dbfd863d4e1dcba1978d736ffc507f0e23eaf26 (diff) | |
download | FreeBSD-src-d67e7a1cc9054fbcf546edfe5ebc03bb5e29d4ca.zip FreeBSD-src-d67e7a1cc9054fbcf546edfe5ebc03bb5e29d4ca.tar.gz |
Be more aggressive in using superpages in all mappings of objects:
- Add a new address space allocation method (VMFS_OPTIMAL_SPACE) for
vm_map_find() that will try to alter the alignment of a mapping to match
any existing superpage mappings of the object being mapped. If no
suitable address range is found with the necessary alignment,
vm_map_find() will fall back to using the simple first-fit strategy
(VMFS_ANY_SPACE).
- Change mmap() without MAP_FIXED, shmat(), and the GEM mapping ioctl to
use VMFS_OPTIMAL_SPACE instead of VMFS_ANY_SPACE.
Reviewed by: alc (earlier version)
MFC after: 2 weeks
Diffstat (limited to 'sys/vm/vm_map.c')
-rw-r--r-- | sys/vm/vm_map.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index 778c054..9cf8827 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -1444,19 +1444,29 @@ vm_map_find(vm_map_t map, vm_object_t object, vm_ooffset_t offset, vm_size_t length, int find_space, vm_prot_t prot, vm_prot_t max, int cow) { - vm_offset_t start; + vm_offset_t start, initial_addr; int result; - start = *addr; + if (find_space == VMFS_OPTIMAL_SPACE && (object == NULL || + (object->flags & OBJ_COLORED) == 0)) + find_space = VMFS_ANY_SPACE; + initial_addr = *addr; +again: + start = initial_addr; vm_map_lock(map); do { if (find_space != VMFS_NO_SPACE) { if (vm_map_findspace(map, start, length, addr)) { vm_map_unlock(map); + if (find_space == VMFS_OPTIMAL_SPACE) { + find_space = VMFS_ANY_SPACE; + goto again; + } return (KERN_NO_SPACE); } switch (find_space) { case VMFS_ALIGNED_SPACE: + case VMFS_OPTIMAL_SPACE: pmap_align_superpage(object, offset, addr, length); break; @@ -1473,11 +1483,11 @@ vm_map_find(vm_map_t map, vm_object_t object, vm_ooffset_t offset, } result = vm_map_insert(map, object, offset, start, start + length, prot, max, cow); - } while (result == KERN_NO_SPACE && (find_space == VMFS_ALIGNED_SPACE + } while (result == KERN_NO_SPACE && (find_space == VMFS_ALIGNED_SPACE || #ifdef VMFS_TLB_ALIGNED_SPACE - || find_space == VMFS_TLB_ALIGNED_SPACE + find_space == VMFS_TLB_ALIGNED_SPACE || #endif - )); + find_space == VMFS_OPTIMAL_SPACE)); vm_map_unlock(map); return (result); } |