Mmmemoryc

static int do_nonlinear_fault(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, pte_t *page_table, pmd_t *pmd, int write_access, pte_t orig_pte)

pgoff = pte_to_pgoff(orig_pte);

return _do_fault(mm, vma, address, pmd, pgoff, flags, orig_pte);

Since the faulting address is not linearly associated with the contents of the mapped file, the desired position must be obtained from the information in the PTE that was previously encoded with pgoff_to_pte. Now comes the time to put this information to use: pte_to_pgoff analyzes the page table entry and obtains the desired page-sized offset into the file.

Once the address within the file is known, reading in the required data can be pursued as for regular page faults. The kernel thus hands off the work to the previously discussed function_do_page_fault and is done.

Continue reading here: Kernel Page Faults

Was this article helpful?

0 0