When vm_map_find(find_space = VMFS_OPTIMAL_SPACE) fails to find space, a

second scan of the address space with find_space = VMFS_ANY_SPACE is
performed.  Previously, vm_map_find() released and reacquired the map lock
between the first and second scans.  However, there is no compelling
reason to do so.  This revision modifies vm_map_find() to retain the map
lock.

Reviewed by:	jhb, kib, markj
MFC after:	1 week
X-Differential Revision:	https://reviews.freebsd.org/D13155
This commit is contained in:
alc 2017-11-22 16:39:24 +00:00
parent 9a2306e46d
commit d21a0d7e26

View File

@ -1513,18 +1513,18 @@ vm_map_find(vm_map_t map, vm_object_t object, vm_ooffset_t offset,
} else
alignment = 0;
initial_addr = *addr;
vm_map_lock(map);
again:
start = initial_addr;
vm_map_lock(map);
do {
if (find_space != VMFS_NO_SPACE) {
if (vm_map_findspace(map, start, length, addr) ||
(max_addr != 0 && *addr + length > max_addr)) {
vm_map_unlock(map);
if (find_space == VMFS_OPTIMAL_SPACE) {
find_space = VMFS_ANY_SPACE;
goto again;
}
vm_map_unlock(map);
return (KERN_NO_SPACE);
}
switch (find_space) {