ANDROID: mm: introduce vma refcounting to protect vma during SPF
Current mechanism to stabilize a vma during speculative page fault
handling makes a copy of the faulting vma under RCU protection. This
makes it hard to protect elements which do not belong to the vma but
are used by the page fault handler like vma->vm_file.
The problems is that a copy of the vma can't be used to safely
protect the file attached to the original vma unless the file is
also released after RCU grace period (which is how SPF was designed
originally but that caused performance regression and had to be
changed).
To avoid these complications, introduce vma refcounting to stabilize
and operate on the original vma during page fault handling. Page
fault handler finds the vma and increases its refcount under RCU
protection, vma is freed after RCU grace period, vma->vm_file is
released only after refcount indicates no users. This mechanism
guarantees that once get_vma returns a vma, both the vma itself and
vma->vm_file are stable.
Additional benefits of this patch are: we don't need to copy the vma
and no additional logic is needed to stabilize vma->vm_file.
Bug: 257443051
Change-Id: I59d373926d687fcbd56847a8c3500c43bf1844c8
Signed-off-by:
Suren Baghdasaryan <surenb@google.com>
Loading
-
mentioned in commit e0a662bd
-
mentioned in commit e717e149
-
mentioned in commit 7bf0e802
-
mentioned in commit 9e0a4c06
-
mentioned in commit 079dbbb6
-
mentioned in commit 7a4c1940
-
mentioned in commit 9382275e
-
mentioned in commit 0afebac3
-
mentioned in commit 9379c56e
-
mentioned in commit 4f1fdb28
-
mentioned in commit df3c46a3
Please sign in to comment