summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_map.c
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>1999-05-18 05:38:48 +0000
committeralc <alc@FreeBSD.org>1999-05-18 05:38:48 +0000
commit016bcfa9ed0679b9ed8e5981f0ec3305d6f35128 (patch)
tree7dd850436bd53ce9de5630e3b57eb1dd150faeea /sys/vm/vm_map.c
parent91cb63bd8223191ce6a215de17a443593f687017 (diff)
downloadFreeBSD-src-016bcfa9ed0679b9ed8e5981f0ec3305d6f35128.zip
FreeBSD-src-016bcfa9ed0679b9ed8e5981f0ec3305d6f35128.tar.gz
vm_map_insert:
General cleanup. Eliminate coalescing checks that are duplicated by vm_object_coalesce.
Diffstat (limited to 'sys/vm/vm_map.c')
-rw-r--r--sys/vm/vm_map.c85
1 files changed, 38 insertions, 47 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
index 882a81b..1fb91f0 100644
--- a/sys/vm/vm_map.c
+++ b/sys/vm/vm_map.c
@@ -61,7 +61,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
- * $Id: vm_map.c,v 1.162 1999/05/16 05:07:31 alc Exp $
+ * $Id: vm_map.c,v 1.163 1999/05/17 00:53:53 alc Exp $
*/
/*
@@ -431,10 +431,6 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_ooffset_t offset,
vm_map_entry_t temp_entry;
u_char protoeflags;
- if ((object != NULL) && (cow & MAP_NOFAULT)) {
- panic("vm_map_insert: paradoxical MAP_NOFAULT request");
- }
-
/*
* Check that the start and end points are not bogus.
*/
@@ -466,9 +462,12 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_ooffset_t offset,
if (cow & MAP_COPY_ON_WRITE)
protoeflags |= MAP_ENTRY_COW|MAP_ENTRY_NEEDS_COPY;
- if (cow & MAP_NOFAULT)
+ if (cow & MAP_NOFAULT) {
protoeflags |= MAP_ENTRY_NOFAULT;
+ KASSERT(object == NULL,
+ ("vm_map_insert: paradoxical MAP_NOFAULT request"));
+ }
if (object) {
/*
* When object is non-NULL, it could be shared with another
@@ -480,47 +479,39 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_ooffset_t offset,
} else {
vm_object_set_flag(object, OBJ_ONEMAPPING);
}
- } else if (
- (prev_entry != &map->header) &&
- ((prev_entry->eflags & MAP_ENTRY_IS_SUB_MAP) == 0) &&
- ((prev_entry->object.vm_object == NULL) ||
- (prev_entry->object.vm_object->type == OBJT_DEFAULT) ||
- (prev_entry->object.vm_object->type == OBJT_SWAP)) &&
- (prev_entry->end == start) &&
- (prev_entry->wired_count == 0)
- ) {
- if ((protoeflags == prev_entry->eflags) &&
- ((cow & MAP_NOFAULT) ||
- vm_object_coalesce(prev_entry->object.vm_object,
- OFF_TO_IDX(prev_entry->offset),
- (vm_size_t) (prev_entry->end - prev_entry->start),
- (vm_size_t) (end - prev_entry->end)))) {
-
- /*
- * We were able to extend the object. Determine if we
- * can extend the previous map entry to include the
- * new range as well.
- */
- if ((prev_entry->inheritance == VM_INHERIT_DEFAULT) &&
- (prev_entry->protection == prot) &&
- (prev_entry->max_protection == max)) {
-
- map->size += (end - prev_entry->end);
- prev_entry->end = end;
- return (KERN_SUCCESS);
- }
-
- /*
- * If we can extend the object but cannot extend the
- * map entry, we have to create a new map entry. We
- * must bump the ref count on the extended object to
- * account for it.
- */
- object = prev_entry->object.vm_object;
- offset = prev_entry->offset +
- (prev_entry->end - prev_entry->start);
- vm_object_reference(object);
+ }
+ else if ((prev_entry != &map->header) &&
+ (prev_entry->eflags == protoeflags) &&
+ (prev_entry->end == start) &&
+ (prev_entry->wired_count == 0) &&
+ ((prev_entry->object.vm_object == NULL) ||
+ vm_object_coalesce(prev_entry->object.vm_object,
+ OFF_TO_IDX(prev_entry->offset),
+ (vm_size_t)(prev_entry->end - prev_entry->start),
+ (vm_size_t)(end - prev_entry->end)))) {
+ /*
+ * We were able to extend the object. Determine if we
+ * can extend the previous map entry to include the
+ * new range as well.
+ */
+ if ((prev_entry->inheritance == VM_INHERIT_DEFAULT) &&
+ (prev_entry->protection == prot) &&
+ (prev_entry->max_protection == max)) {
+ map->size += (end - prev_entry->end);
+ prev_entry->end = end;
+ return (KERN_SUCCESS);
}
+
+ /*
+ * If we can extend the object but cannot extend the
+ * map entry, we have to create a new map entry. We
+ * must bump the ref count on the extended object to
+ * account for it.
+ */
+ object = prev_entry->object.vm_object;
+ offset = prev_entry->offset +
+ (prev_entry->end - prev_entry->start);
+ vm_object_reference(object);
}
/*
@@ -558,7 +549,7 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_ooffset_t offset,
* Update the free space hint
*/
if ((map->first_free == prev_entry) &&
- (prev_entry->end >= new_entry->start))
+ (prev_entry->end >= new_entry->start))
map->first_free = new_entry;
if (cow & (MAP_PREFAULT|MAP_PREFAULT_PARTIAL))
OpenPOWER on IntegriCloud