mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-20 08:44:33 +00:00
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
This commit is contained in:
parent
4f66641749
commit
a922d312b0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=243529
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue