diff options
author | Suren Baghdasaryan <surenb@google.com> | 2023-02-27 09:36:25 -0800 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2023-04-05 20:03:00 -0700 |
commit | 17c05f18e54158a3eed0c22c85b7a756b63dcc01 (patch) | |
tree | 4170c5e1845643bec3a734af3b8f4283a9e8d6d4 /mm/memory.c | |
parent | 55324e46eb8b886ecd08c9a089d3a694c705b3b0 (diff) |
mm: prevent do_swap_page from handling page faults under VMA lock
Due to the possibility of do_swap_page dropping mmap_lock, abort fault
handling under VMA lock and retry holding mmap_lock. This can be handled
more gracefully in the future.
Link: https://lkml.kernel.org/r/20230227173632.3292573-27-surenb@google.com
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Reviewed-by: Laurent Dufour <laurent.dufour@fr.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/memory.c')
-rw-r--r-- | mm/memory.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/mm/memory.c b/mm/memory.c index 10d497a5296c..70f4b1222e5d 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3697,6 +3697,11 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) if (!pte_unmap_same(vmf)) goto out; + if (vmf->flags & FAULT_FLAG_VMA_LOCK) { + ret = VM_FAULT_RETRY; + goto out; + } + entry = pte_to_swp_entry(vmf->orig_pte); if (unlikely(non_swap_entry(entry))) { if (is_migration_entry(entry)) { |