diff options
author | Pindar Yang <pindaryang@google.com> | 2024-02-21 09:46:47 +0000 |
---|---|---|
committer | Pindar Yang <pindaryang@google.com> | 2024-02-21 09:46:50 +0000 |
commit | bd396302ff65cac3f4e9b2dd6c3483b135e7bcf9 (patch) | |
tree | d99ca7955f7900f0eb4dedbf0f0ddec0909b828d | |
parent | ea3759147fe45e8b9f7d518024358cabc3bb6b97 (diff) | |
parent | 11d7e4f57f688287511f911187ada11784b4263d (diff) | |
download | gs-bd396302ff65cac3f4e9b2dd6c3483b135e7bcf9.tar.gz |
Merge android13-5.10-2024-01 ab/11392938 into android13-gs-pixel-5.10-24Q2
Merge SHA:
11d7e4f57f68 ANDROID: mm: Fix VMA ref count after fast-mremap
Bug: 322411509
Bug: 317942806 (ACK)
Bug: 322411509 (ACK)
Bug: 323371343 (ACK)
Change-Id: Icfe64eb3f1e3bbd72f118d0e5244f87273fc09c2
Signed-off-by: Pindar Yang <pindaryang@google.com>
-rw-r--r-- | mm/mremap.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/mm/mremap.c b/mm/mremap.c index a6484e845706..fa90d4b7aa0e 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -217,7 +217,7 @@ static inline bool trylock_vma_ref_count(struct vm_area_struct *vma) * If we have the only reference, swap the refcount to -1. This * will prevent other concurrent references by get_vma() for SPFs. */ - return atomic_cmpxchg(&vma->vm_ref_count, 1, -1) == 1; + return atomic_cmpxchg_acquire(&vma->vm_ref_count, 1, -1) == 1; } /* @@ -225,12 +225,13 @@ static inline bool trylock_vma_ref_count(struct vm_area_struct *vma) */ static inline void unlock_vma_ref_count(struct vm_area_struct *vma) { + int old = atomic_xchg_release(&vma->vm_ref_count, 1); + /* * This should only be called after a corresponding, * successful trylock_vma_ref_count(). */ - VM_BUG_ON_VMA(atomic_cmpxchg(&vma->vm_ref_count, -1, 1) != -1, - vma); + VM_BUG_ON_VMA(old != -1, vma); } #else /* !CONFIG_SPECULATIVE_PAGE_FAULT */ static inline bool trylock_vma_ref_count(struct vm_area_struct *vma) |