summaryrefslogtreecommitdiffstats
path: root/sys/vm
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2008-05-17 19:32:48 +0000
committeralc <alc@FreeBSD.org>2008-05-17 19:32:48 +0000
commit0a1d595c3a05b5075ea4d4a2115dbc2de57709fb (patch)
tree6129febfd8b026270e8f7f75287619a66831ca1b /sys/vm
parent1e4c5769ebffc1aa3236011daf53b8ec6e91ff31 (diff)
downloadFreeBSD-src-0a1d595c3a05b5075ea4d4a2115dbc2de57709fb.zip
FreeBSD-src-0a1d595c3a05b5075ea4d4a2115dbc2de57709fb.tar.gz
In order to map device memory using superpages, mmap(2) must find a
superpage-aligned virtual address for the mapping. Revision 1.65 implemented an overly simplistic and generally ineffectual method for finding a superpage-aligned virtual address. Specifically, it rounds the virtual address corresponding to the end of the data segment up to the next superpage-aligned virtual address. If this virtual address is unallocated, then the device will be mapped using superpages. Unfortunately, in modern times, where applications like the X server dynamically load much of their code, this virtual address is already allocated. In such cases, mmap(2) simply uses the first available virtual address, which is not necessarily superpage aligned. This revision changes mmap(2) to use a more robust method, specifically, the VMFS_ALIGNED_SPACE option that is now implemented by vm_map_find().
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vm_mmap.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c
index d5b6e3c..ca86cf9 100644
--- a/sys/vm/vm_mmap.c
+++ b/sys/vm/vm_mmap.c
@@ -1456,15 +1456,13 @@ vm_mmap(vm_map_t map, vm_offset_t *addr, vm_size_t size, vm_prot_t prot,
maxprot |= VM_PROT_EXECUTE;
#endif
- if (fitit)
- *addr = pmap_addr_hint(object, *addr, size);
-
if (flags & MAP_STACK)
rv = vm_map_stack(map, *addr, size, prot, maxprot,
docow | MAP_STACK_GROWS_DOWN);
else if (fitit)
- rv = vm_map_find(map, object, foff, addr, size, TRUE,
- prot, maxprot, docow);
+ rv = vm_map_find(map, object, foff, addr, size,
+ object != NULL && object->type == OBJT_DEVICE ?
+ VMFS_ALIGNED_SPACE : VMFS_ANY_SPACE, prot, maxprot, docow);
else
rv = vm_map_fixed(map, object, foff, *addr, size,
prot, maxprot, docow);
OpenPOWER on IntegriCloud