diff options
author | Alan Cox <alc@FreeBSD.org> | 1999-05-18 05:38:48 +0000 |
---|---|---|
committer | Alan Cox <alc@FreeBSD.org> | 1999-05-18 05:38:48 +0000 |
commit | 4e045f937b222c7bac35d4d6417d33d7e44ea1ba (patch) | |
tree | 2f5b5473bd94de43ac1daff5ee28078a65309abe /sys | |
parent | 78121e79aa390b2e94fb8aca2d0477d81aa20cf2 (diff) | |
download | src-4e045f937b222c7bac35d4d6417d33d7e44ea1ba.tar.gz src-4e045f937b222c7bac35d4d6417d33d7e44ea1ba.zip |
vm_map_insert:
General cleanup. Eliminate coalescing checks that are duplicated
by vm_object_coalesce.
Notes
Notes:
svn path=/head/; revision=47290
Diffstat (limited to 'sys')
-rw-r--r-- | sys/vm/vm_map.c | 85 |
1 files changed, 38 insertions, 47 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index 882a81bcb620..1fb91f0b8653 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)) |