]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm: prevent do_swap_page from handling page faults under VMA lock
authorSuren Baghdasaryan <surenb@google.com>
Sun, 29 May 2022 20:20:27 +0000 (13:20 -0700)
committerSuren Baghdasaryan <surenb@google.com>
Wed, 23 Nov 2022 02:09:46 +0000 (02:09 +0000)
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.

Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Reviewed-by: Laurent Dufour <laurent.dufour@fr.ibm.com>
mm/memory.c

index 6640b8cba622075395871b0a70a076a2c30326fd..57279e03f8885bc775a59bdc36094f2904279f12 100644 (file)
@@ -3744,6 +3744,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)) {