BACKPORT: FROMGIT: mm: allow per-VMA locks on file-backed VMAs
Remove the TCP layering violation by allowing per-VMA locks on all VMAs. The fault path will immediately fail in handle_mm_fault(). There may be a small performance reduction from this patch as a little unnecessary work will be done on each page fault. See later patches for the improvement. Link: https://lkml.kernel.org/r/20230724185410.1124082-3-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Suren Baghdasaryan <surenb@google.com> Cc: Arjun Roy <arjunroy@google.com> Cc: Eric Dumazet <edumazet@google.com> Cc: Punit Agrawal <punit.agrawal@bytedance.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> (cherry picked from commit 698dcd77360a3ce15dfc6fe55f9b5572ad4c4291 https: //git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable) [surenb: skip tcp-related changes] Bug: 293665307 Change-Id: I73d9d1e4f96419d4723a920fc5960e806749c368 Signed-off-by: Suren Baghdasaryan <surenb@google.com>
This commit is contained in:
parent
4cb518a06f
commit
e26044769f
@ -5267,6 +5267,11 @@ vm_fault_t handle_mm_fault(struct vm_area_struct *vma, unsigned long address,
|
||||
goto out;
|
||||
}
|
||||
|
||||
if ((flags & FAULT_FLAG_VMA_LOCK) && !vma_is_anonymous(vma)) {
|
||||
vma_end_read(vma);
|
||||
return VM_FAULT_RETRY;
|
||||
}
|
||||
|
||||
/*
|
||||
* Enable the memcg OOM handling for faults triggered in user
|
||||
* space. Kernel faults are handled more gracefully.
|
||||
@ -5438,10 +5443,6 @@ struct vm_area_struct *lock_vma_under_rcu(struct mm_struct *mm,
|
||||
if (!vma)
|
||||
goto inval;
|
||||
|
||||
/* Only anonymous vmas are supported for now */
|
||||
if (!vma_is_anonymous(vma))
|
||||
goto inval;
|
||||
|
||||
if (!vma_start_read(vma))
|
||||
goto inval;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user