summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_map.c
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2012-11-25 19:42:36 +0000
committeralc <alc@FreeBSD.org>2012-11-25 19:42:36 +0000
commite44badfb9f1ce440d6e16f554458c2f23ae3ba44 (patch)
tree552d1a26db1bc027e5ea93575c7ea998a9326d38 /sys/vm/vm_map.c
parentaec1bace621b2fdbe4e0ed9d34094fe5322edbf3 (diff)
downloadFreeBSD-src-e44badfb9f1ce440d6e16f554458c2f23ae3ba44.zip
FreeBSD-src-e44badfb9f1ce440d6e16f554458c2f23ae3ba44.tar.gz
Make a few small changes to vm_map_pmap_enter():
Add detail to the comment describing this function. In particular, describe what MAP_PREFAULT_PARTIAL does. Eliminate the abrupt change in behavior when the specified address range grows from MAX_INIT_PT pages to MAX_INIT_PT plus one pages. Instead of doing nothing, i.e., preloading no mappings whatsoever, map any resident pages that fall within the start of the specified address range, i.e., [addr, addr + ulmin(size, ptoa(MAX_INIT_PT))). Long ago, the vm object's list of resident pages was not ordered, so this function had to choose between probing the global hash table of all resident pages and iterating over the vm object's unordered list of resident pages. Now, the list is ordered, so there is no reason for MAP_PREFAULT_PARTIAL to be concerned with the vm object's count of resident changes. MFC after: 14 days
Diffstat (limited to 'sys/vm/vm_map.c')
-rw-r--r--sys/vm/vm_map.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
index 034754a..4ed0691 100644
--- a/sys/vm/vm_map.c
+++ b/sys/vm/vm_map.c
@@ -1793,10 +1793,14 @@ vm_map_submap(
/*
* vm_map_pmap_enter:
*
- * Preload read-only mappings for the given object's resident pages into
- * the given map. This eliminates the soft faults on process startup and
- * immediately after an mmap(2). Because these are speculative mappings,
- * cached pages are not reactivated and mapped.
+ * Preload read-only mappings for the specified object's resident pages
+ * into the target map. If "flags" is MAP_PREFAULT_PARTIAL, then only
+ * the resident pages within the address range [addr, addr + ulmin(size,
+ * ptoa(MAX_INIT_PT))) are mapped. Otherwise, all resident pages within
+ * the specified address range are mapped. This eliminates many soft
+ * faults on process startup and immediately after an mmap(2). Because
+ * these are speculative mappings, cached pages are not reactivated and
+ * mapped.
*/
void
vm_map_pmap_enter(vm_map_t map, vm_offset_t addr, vm_prot_t prot,
@@ -1815,11 +1819,8 @@ vm_map_pmap_enter(vm_map_t map, vm_offset_t addr, vm_prot_t prot,
}
psize = atop(size);
-
- if ((flags & MAP_PREFAULT_PARTIAL) && psize > MAX_INIT_PT &&
- object->resident_page_count > MAX_INIT_PT)
- goto unlock_return;
-
+ if (psize > MAX_INIT_PT && (flags & MAP_PREFAULT_PARTIAL) != 0)
+ psize = MAX_INIT_PT;
if (psize + pindex > object->size) {
if (object->size < pindex)
goto unlock_return;
OpenPOWER on IntegriCloud