summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authordyson <dyson@FreeBSD.org>1996-12-07 00:03:43 +0000
committerdyson <dyson@FreeBSD.org>1996-12-07 00:03:43 +0000
commit468189da8dc8f5800f91f42136c373855131c9b1 (patch)
treecc09ae3bd58018d8b296ebd70af3652f0e527da3 /sys
parent0dc3710893bc1d58373ac19f6525d7ab3b2eace8 (diff)
downloadFreeBSD-src-468189da8dc8f5800f91f42136c373855131c9b1.zip
FreeBSD-src-468189da8dc8f5800f91f42136c373855131c9b1.tar.gz
Make vm_map_insert much more intelligent in the MAP_NOFAULT case so
that map entries are coalesced when appropriate. Also, conditionalize some code that is currently not used in vm_map_insert. This mod has been added to eliminate unnecessary map entries in buffer map. Additionally, there were some cases where map coalescing could be done when it shouldn't. That problem has been resolved.
Diffstat (limited to 'sys')
-rw-r--r--sys/vm/vm_map.c32
-rw-r--r--sys/vm/vm_map.h4
2 files changed, 29 insertions, 7 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
index 48071a0..4d2c403 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.57 1996/09/14 11:54:55 bde Exp $
+ * $Id: vm_map.c,v 1.58 1996/11/30 22:41:47 dyson Exp $
*/
/*
@@ -581,6 +581,7 @@ vm_map_lookup_entry(map, address, entry)
return (FALSE);
}
+#define VM_MAP_INSERT_NULL_OBJECT_ONLY
/*
* vm_map_insert:
*
@@ -605,6 +606,10 @@ vm_map_insert(map, object, offset, start, end, prot, max, cow)
vm_map_entry_t temp_entry;
vm_object_t prev_object;
+ if ((object != NULL) && (cow & MAP_NOFAULT)) {
+ panic("vm_map_insert: paradoxical MAP_NOFAULT request");
+ }
+
/*
* Check that the start and end points are not bogus.
*/
@@ -633,7 +638,11 @@ vm_map_insert(map, object, offset, start, end, prot, max, cow)
if ((prev_entry != &map->header) &&
(prev_entry->end == start) &&
+#if !defined(VM_MAP_INSERT_NULL_OBJECT_ONLY)
((object == NULL) || (prev_entry->object.vm_object == object)) &&
+#else
+ (object == NULL) &&
+#endif
(prev_entry->is_a_map == FALSE) &&
(prev_entry->is_sub_map == FALSE) &&
(prev_entry->inheritance == VM_INHERIT_DEFAULT) &&
@@ -646,12 +655,21 @@ vm_map_insert(map, object, offset, start, end, prot, max, cow)
* See if we can avoid creating a new entry by extending one of our
* neighbors.
*/
+#if !defined(VM_MAP_INSERT_NULL_OBJECT_ONLY)
if (object == NULL) {
- if (vm_object_coalesce(prev_entry->object.vm_object,
+#endif
+ u_char needs_copy = (cow & MAP_COPY_NEEDED) != 0;
+ u_char copy_on_write = (cow & MAP_COPY_ON_WRITE) != 0;
+ u_char nofault = (cow & MAP_NOFAULT) != 0;
+
+ if ((needs_copy == prev_entry->needs_copy) &&
+ (copy_on_write == prev_entry->copy_on_write) &&
+ (nofault == prev_entry->nofault) &&
+ (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))) {
+ (vm_size_t) (end - prev_entry->end)))) {
/*
* Coalesced the two objects - can extend the
@@ -660,11 +678,15 @@ vm_map_insert(map, object, offset, start, end, prot, max, cow)
*/
map->size += (end - prev_entry->end);
prev_entry->end = end;
- prev_object = prev_entry->object.vm_object;
- default_pager_convert_to_swapq(prev_object);
+ if (!nofault) {
+ prev_object = prev_entry->object.vm_object;
+ default_pager_convert_to_swapq(prev_object);
+ }
return (KERN_SUCCESS);
}
+#if !defined(VM_MAP_INSERT_NULL_OBJECT_ONLY)
}
+#endif
}
/*
* Create a new entry
diff --git a/sys/vm/vm_map.h b/sys/vm/vm_map.h
index 40569ef..af36fb4 100644
--- a/sys/vm/vm_map.h
+++ b/sys/vm/vm_map.h
@@ -61,7 +61,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
- * $Id: vm_map.h,v 1.15 1996/07/30 03:08:11 dyson Exp $
+ * $Id: vm_map.h,v 1.16 1996/11/30 22:41:48 dyson Exp $
*/
/*
@@ -104,7 +104,7 @@ struct vm_map_entry {
vm_offset_t end; /* end address */
union vm_map_object object; /* object I point to */
vm_ooffset_t offset; /* offset into object */
- boolean_t is_a_map:1, /* Is "object" a map? */
+ u_char is_a_map:1, /* Is "object" a map? */
is_sub_map:1, /* Is "object" a submap? */
copy_on_write:1, /* is data copy-on-write */
needs_copy:1, /* does object need to be copied */
OpenPOWER on IntegriCloud