summaryrefslogtreecommitdiff
path: root/mm/memory.c
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2023-07-24 19:54:09 +0100
committerAndrew Morton <akpm@linux-foundation.org>2023-08-18 10:12:52 -0700
commit4c2f803abb1797e571579adcaf134a727b3ffc48 (patch)
tree03b4284cf177619613e9e7793750cb0ab660551b /mm/memory.c
parentf5617ffeb450f84c57f7eba1a3524a29955d42b7 (diff)
mm: handle swap and NUMA PTE faults under the VMA lock
Move the FAULT_FLAG_VMA_LOCK check down in handle_pte_fault(). This is probably not a huge win in its own right, but is a nicely separable bit from the next patch. Link: https://lkml.kernel.org/r/20230724185410.1124082-10-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: Arjun Roy <arjunroy@google.com> Cc: Eric Dumazet <edumazet@google.com> Cc: Punit Agrawal <punit.agrawal@bytedance.com> Cc: Suren Baghdasaryan <surenb@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/memory.c')
-rw-r--r--mm/memory.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/mm/memory.c b/mm/memory.c
index 52235aa3d665..c122adce47b4 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -4979,18 +4979,18 @@ static vm_fault_t handle_pte_fault(struct vm_fault *vmf)
if (!vmf->pte)
return do_pte_missing(vmf);
- if ((vmf->flags & FAULT_FLAG_VMA_LOCK) && !vma_is_anonymous(vmf->vma)) {
- pte_unmap(vmf->pte);
- vma_end_read(vmf->vma);
- return VM_FAULT_RETRY;
- }
-
if (!pte_present(vmf->orig_pte))
return do_swap_page(vmf);
if (pte_protnone(vmf->orig_pte) && vma_is_accessible(vmf->vma))
return do_numa_page(vmf);
+ if ((vmf->flags & FAULT_FLAG_VMA_LOCK) && !vma_is_anonymous(vmf->vma)) {
+ pte_unmap(vmf->pte);
+ vma_end_read(vmf->vma);
+ return VM_FAULT_RETRY;
+ }
+
spin_lock(vmf->ptl);
entry = vmf->orig_pte;
if (unlikely(!pte_same(ptep_get(vmf->pte), entry))) {