aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mm/rmap.c
diff options
context:
space:
mode:
authorSuren Baghdasaryan <surenb@google.com>2023-02-27 09:36:11 -0800
committerAndrew Morton <akpm@linux-foundation.org>2023-04-05 20:02:57 -0700
commit5e31275cc997f8ec5d9e8d65fe9840ebed89db19 (patch)
tree0afeeee12442b0781c3b29c5e0227aded0d8fee2 /mm/rmap.c
parentmm: move mmap_lock assert function definitions (diff)
downloadwireguard-linux-5e31275cc997f8ec5d9e8d65fe9840ebed89db19.tar.xz
wireguard-linux-5e31275cc997f8ec5d9e8d65fe9840ebed89db19.zip
mm: add per-VMA lock and helper functions to control it
Introduce per-VMA locking. The lock implementation relies on a per-vma and per-mm sequence counters to note exclusive locking: - read lock - (implemented by vma_start_read) requires the vma (vm_lock_seq) and mm (mm_lock_seq) sequence counters to differ. If they match then there must be a vma exclusive lock held somewhere. - read unlock - (implemented by vma_end_read) is a trivial vma->lock unlock. - write lock - (vma_start_write) requires the mmap_lock to be held exclusively and the current mm counter is assigned to the vma counter. This will allow multiple vmas to be locked under a single mmap_lock write lock (e.g. during vma merging). The vma counter is modified under exclusive vma lock. - write unlock - (vma_end_write_all) is a batch release of all vma locks held. It doesn't pair with a specific vma_start_write! It is done before exclusive mmap_lock is released by incrementing mm sequence counter (mm_lock_seq). - write downgrade - if the mmap_lock is downgraded to the read lock, all vma write locks are released as well (effectivelly same as write unlock). Link: https://lkml.kernel.org/r/20230227173632.3292573-13-surenb@google.com Signed-off-by: Suren Baghdasaryan <surenb@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/rmap.c')
0 files changed, 0 insertions, 0 deletions