Page fault handling in vpagetable area clarification

Matthew Dillon dillon at
Mon Feb 12 09:18:01 PST 2007

:Right, but that's the read fault on writable page case. My question was about 
:a _write_ fault on writable page. The way I'm reading the code, the host 
:kernel again maps the page read only (vm_fault_object() clears the write bit 
:from fs.prot, so after return to vm_fault(), pmap_enter() will map the page 
:read only. However, since this is a _write_ fault, vm_fault_vpagetable() has 
:already set VPTE_M in the vpagetable. Therefore, the real kernel doesn't have 
:to worry about the modified bit (it's already set in the vpagetable, that's 
:enough, right?). So I don't see why the page can't be mapped RW.

    The write bit should not be cleared from fs.prot in that case.  Check
    the conditionals on fault_type in vm_fault_object().

    case 1:  line 751 vm/vm_fault.c (in HEAD).  

	VM_PROT_WRITE is only cleared if fault_type was not a write fault

    case 2:  line 1238 vm/vm_fault.c (in HEAD).

	VM_PROT_WRITE is only cleared in the 'else' portion of a conditional
	that tested whether fault_type was VM_PROT_WRITE (so again it is
	only cleared if the fault_type was not a write fault).

    If I'm looking in the wrong place I'll need a file & line number to

					Matthew Dillon 
					<dillon at>

More information about the Kernel mailing list