Re: [PATCH v2 1/2] mm: protect free_pgtables with mmap_lock write lock in exit_mmap

From: Matthew Wilcox
Date: Mon Dec 06 2021 - 13:52:56 EST


On Mon, Dec 06, 2021 at 10:35:03AM -0800, Suren Baghdasaryan wrote:
> > Other than that looks OK to me. Maybe we want to add an explicit note
> > that vm_ops::close cannot take mmap_sem in any form. The changelog
> > should also mention that you have considered remove_vma and its previous
> > no MM locking assumption. You can argue that fput is async and close
> > callback shouldn't really need mmap_sem.
>
> Should I post another version of this patch with the patch description
> clarifying these points and additional comments as you suggested?

fyi, vm_ops->close() is already called with the mmap_sem held for write
in __split_vma(). If that needs to be documented, it's a separate patch
because it's absolutely not a consequence of this patch.