]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm: fall back to mmap_lock if vma->anon_vma is not yet set
authorSuren Baghdasaryan <surenb@google.com>
Mon, 27 Feb 2023 17:36:23 +0000 (09:36 -0800)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 28 Mar 2023 23:24:54 +0000 (16:24 -0700)
commitc64858eb831e69d0ab825c051bae8727d8fa9cb4
treee19fcb1fda663f638b8677e152703041eedc3a36
parentf5d69cd63bec4849e0370efc6fa070752f7a9836
mm: fall back to mmap_lock if vma->anon_vma is not yet set

When vma->anon_vma is not set, page fault handler will set it by either
reusing anon_vma of an adjacent VMA if VMAs are compatible or by
allocating a new one.  find_mergeable_anon_vma() walks VMA tree to find a
compatible adjacent VMA and that requires not only the faulting VMA to be
stable but also the tree structure and other VMAs inside that tree.
Therefore locking just the faulting VMA is not enough for this search.
Fall back to taking mmap_lock when vma->anon_vma is not set.  This
situation happens only on the first page fault and should not affect
overall performance.

Link: https://lkml.kernel.org/r/20230227173632.3292573-25-surenb@google.com
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/memory.c