summaryrefslogtreecommitdiff
path: root/i386
diff options
context:
space:
mode:
authorMaksym Planeta <mcsim.planeta@gmail.com>2012-10-08 22:31:30 +0200
committerMaksym Planeta <mcsim.planeta@gmail.com>2012-10-28 12:23:37 +0100
commite1a950b2649f056330cacf5016c91a4f8653f49c (patch)
tree202081df5838565acc5695d737fdb311f6b6d83b /i386
parent5fb4561e864d834cf7c637f6c798f04aea26c23e (diff)
Add processing of page faults in clusteres in Mach kernel
Earlier, when page fault occurred, control reached the function vm_fault_page, that determined the reason of the fault and if the reason was appropriate, kernel asked a pager for data that should be stored in that single page. The main idea behind this commit is to determine and than request not only one page, but a bunch of them. Almost all work is done in function vm_fault_page, but to keep the size of this function there was added a bunch of helper functions for internal use in vm_fault_page. * i386/intel/read_fault.c (intel_read_fault): New prototype of vm_fault_page requires supplying of map entry in which fault occurred, so change function appropriately. * vm/vm_fault.h (vm_fault_page): Update function prototype. * vm/vm_fault.c (min): New macro. (vm_fault_state_t): New field. (vm_advice_table): New table where parameters for types of memory advice are stored. (map_function_parameter_t): New union for internal use. (vm_mark_for_pagein): New function for internal use. (vm_mark_for_unlock): Likewise. (vm_free_after_error): Likewise. (vm_cleanup_after_error): Likewise. (vm_calculate_clusters): Likewise. (dont_request_page): Likewise. (dont_unlock_page): Likewise. (vm_for_every_page): Likewise. (vm_fault_page): Function has been changed to request data in clusters. Its prototype has been changed to supply to this function information regarding memory entry where page fault occurred. (vm_fault): Function has been changed to supply function vm_fault_page with information regarding memory entry where page fault occurred. (vm_fault_unwire): Function changed to call vm_fault_page with new prototype. (vm_fault_copy): Likewise. * vm/vm_map.c (vm_map_copyin_page_list): Function changed to call vm_fault_page with new prototype. * vm/vm_object.c (vm_object_copy_slowly): Function changed to call vm_fault_page with new prototype.
Diffstat (limited to 'i386')
-rw-r--r--i386/intel/read_fault.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/i386/intel/read_fault.c b/i386/intel/read_fault.c
index 762f60da..d29ce1c4 100644
--- a/i386/intel/read_fault.c
+++ b/i386/intel/read_fault.c
@@ -49,6 +49,7 @@ intel_read_fault(map, vaddr)
vm_offset_t offset; /* Top-level offset */
vm_prot_t prot; /* Protection for mapping */
vm_page_t result_page; /* Result of vm_fault_page */
+ vm_map_entry_t map_entry; /* Supplied to vm_fault_page */
vm_page_t top_page; /* Placeholder page */
boolean_t wired; /* Is map region wired? */
kern_return_t result;
@@ -65,6 +66,10 @@ intel_read_fault(map, vaddr)
if (result != KERN_SUCCESS)
return (result);
+ result = vm_map_lookup_entry(map, vaddr, &map_entry);
+ if (result != KERN_SUCCESS)
+ return (result);
+
/*
* Make a reference to this object to prevent its
* disposal while we are playing with it.
@@ -73,8 +78,8 @@ intel_read_fault(map, vaddr)
object->ref_count++;
vm_object_paging_begin(object);
- result = vm_fault_page(object, offset, VM_PROT_READ, FALSE, TRUE,
- &prot, &result_page, &top_page,
+ result = vm_fault_page(object, offset, map_entry, VM_PROT_READ, FALSE,
+ TRUE, &prot, &result_page, &top_page,
FALSE, (void (*)()) 0);
if (result != VM_FAULT_SUCCESS) {