Skip to content

Commit

Permalink
mm: handle read faults under the VMA lock
Browse files Browse the repository at this point in the history
Most file-backed faults are already handled through ->map_pages(), but if
we need to do I/O we'll come this way.  Since filemap_fault() is now safe
to be called under the VMA lock, we can handle these faults under the VMA
lock now.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Matthew Wilcox (Oracle) <[email protected]>
Cc: Suren Baghdasaryan <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
Matthew Wilcox (Oracle) authored and akpm00 committed Oct 6, 2023
1 parent 4708d7c commit 78018dc
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions mm/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -4620,10 +4620,9 @@ static vm_fault_t do_read_fault(struct vm_fault *vmf)
return ret;
}

if (vmf->flags & FAULT_FLAG_VMA_LOCK) {
vma_end_read(vmf->vma);
return VM_FAULT_RETRY;
}
ret = vmf_can_call_fault(vmf);
if (ret)
return ret;

ret = __do_fault(vmf);
if (unlikely(ret & (VM_FAULT_ERROR | VM_FAULT_NOPAGE | VM_FAULT_RETRY)))
Expand Down

0 comments on commit 78018dc

Please sign in to comment.