filemap_fault
Prev | More Memory Management Functions | Next

## Name

filemap_fault — read in file data for page fault handling

## Synopsis

`int filemap_fault (` | struct vm_area_struct * vma,
| struct vm_fault * vmf`)`;

## Arguments

`vma`

  vma in which the fault was taken

`vmf`

  struct vm_fault containing details of the fault

## Description

`filemap_fault` is invoked via the vma operations vector for a mapped memory region to read in file data during a page fault.

The goto's are kind of ugly, but this streamlines the normal case of having it in the page cache, and handles the special cases reasonably without having a lot of duplicated code.

vma->vm_mm->mmap_sem must be held on entry.

If our return value has VM_FAULT_RETRY set, it's because `lock_page_or_retry` returned 0. The mmap_sem has usually been released in this case. See `__lock_page_or_retry` for the exception.

If our return value does not have VM_FAULT_RETRY set, the mmap_sem has not been released.

We never return with VM_FAULT_RETRY and a bit from VM_FAULT_ERROR set.

Prev | Up | Next
generic_file_read_iter | Home | read_cache_page