Re: [PATCH v3 1/2] mm: protect free_pgtables with mmap_lock write lock in exit_mmap
From: Suren Baghdasaryan <surenb@google.com>
Date: 2021-12-07 23:08:33
Also in:
lkml
On Tue, Dec 7, 2021 at 2:47 PM Suren Baghdasaryan [off-list ref] wrote:
On Tue, Dec 7, 2021 at 2:07 PM Matthew Wilcox [off-list ref] wrote:quoted
On Tue, Dec 07, 2021 at 01:50:30PM -0800, Suren Baghdasaryan wrote:quoted
- Added a comment for vm_operations_struct::close, documenting restriction for taking mmap_lock in the callback, per Michal Hocko and Matthew WilcoxThis should be a separate patch because it stands alone, but ...I thought about it and since it was relevant to the change in remove_vma locking, I thought it would fit here. However, if you insist on splitting it, I'll post it as a separate patch. Please let me know.quoted
quoted
struct vm_operations_struct { void (*open)(struct vm_area_struct * area); + /* + * Called with mmap_lock lock held for write from __split_vma and + * remove_vma, therefore should never take that lock. + */Your whitespace indentation is weird. And it'd be nice to make this a kernel-doc comment (I know none of the others are, but that should be fixed too). And naming the functions that call it is wrong too. /** * @close: Called when the VMA is being removed from the MM. * Context: Caller holds mmap_lock.
BTW, is the caller always required to hold mmap_lock for write or it *might* hold it?
quoted
*/Ack. Will change and include in the next respin once I hear from you on the preference for a separate patch. Thanks!