From 0864756fb0c38dfd1976811fd0a3947db292124a Mon Sep 17 00:00:00 2001 From: Suren Baghdasaryan Date: Wed, 8 Jun 2022 08:28:22 -0700 Subject: [PATCH] Revert "ANDROID: Use the notifier lock to perform file-backed vma teardown" This reverts commit dc8ac508afd3b105978fd3dd98462950daa5b297. Reason for revert: performance regression. Bug: 234527424 Signed-off-by: Suren Baghdasaryan Change-Id: I5811c7ee2feac7f9057ed0ccd848e5de71f79354 --- kernel/fork.c | 7 ------- mm/memory.c | 12 +++--------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/kernel/fork.c b/kernel/fork.c index 4ab5d3f6b81f..014a813f221b 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -402,13 +402,6 @@ void vm_area_free(struct vm_area_struct *vma) free_anon_vma_name(vma); #ifdef CONFIG_SPECULATIVE_PAGE_FAULT if (atomic_read(&vma->vm_mm->mm_users) > 1) { - if (vma->vm_file) { - struct mm_struct *mm = vma->vm_mm; - percpu_down_write(mm->mmu_notifier_lock); - ____vm_area_free(vma); - percpu_up_write(mm->mmu_notifier_lock); - return; - } call_rcu(&vma->vm_rcu, __vm_area_free); return; } diff --git a/mm/memory.c b/mm/memory.c index 8e610f97dc10..04e9b0a388f1 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3988,16 +3988,10 @@ static vm_fault_t __do_fault(struct vm_fault *vmf) /* * The mmap sequence count check guarantees that the * vma we fetched at the start of the fault was still - * current at that point in time. The notifier lock - * ensures vmf->vma->vm_file stays valid. vma is - * stable because we are operating on a copy made at - * the start of the fault. + * current at that point in time. The rcu read lock + * ensures vmf->vma->vm_file stays valid. */ - if (mmu_notifier_trylock(vmf->vma->vm_mm)) { - ret = vma->vm_ops->fault(vmf); - mmu_notifier_unlock(vmf->vma->vm_mm); - } else - ret = VM_FAULT_RETRY; + ret = vma->vm_ops->fault(vmf); } rcu_read_unlock(); } else