Re: [PATCH v7 10/17] mm: uninline the main body of vma_start_write()

Suren Baghdasaryan
2025-01-07T18:51:29Z

On Tue, Jan 7, 2025 at 9:45 AM Suren Baghdasaryan <surenb@google.com> wrote:
>
> On Tue, Jan 7, 2025 at 9:35 AM Vlastimil Babka <vbabka@suse.cz> wrote:
> >
> > On 12/26/24 18:07, Suren Baghdasaryan wrote:
> > > vma_start_write() is used in many places and will grow in size very soon.
> > > It is not used in performance critical paths and uninlining it should
> > > limit the future code size growth.
> > > No functional changes.
> > >
> > > Signed-off-by: Suren Baghdasaryan <surenb@google.com>
> >
> > Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
> >
> > > --- a/mm/memory.c
> > > +++ b/mm/memory.c
> > > @@ -6328,6 +6328,20 @@ struct vm_area_struct *lock_mm_and_find_vma(struct mm_struct *mm,
> > > #endif
> > >
> > > #ifdef CONFIG_PER_VMA_LOCK
> > > +void __vma_start_write(struct vm_area_struct *vma, unsigned int mm_lock_seq)
> > > +{
> > > + down_write(&vma->vm_lock.lock);
> > > + /*
> > > + * We should use WRITE_ONCE() here because we can have concurrent reads
> > > + * from the early lockless pessimistic check in vma_start_read().
> > > + * We don't really care about the correctness of that early check, but
> > > + * we should use WRITE_ONCE() for cleanliness and to keep KCSAN happy.
> > > + */
> > > + WRITE_ONCE(vma->vm_lock_seq, mm_lock_seq);
> > > + up_write(&vma->vm_lock.lock);
> > > +}
> > > +EXPORT_SYMBOL_GPL(__vma_start_write);
> >
> > Do any modules need it? If not we shouldn't export.
>
> I'm pretty sure I added it because of the allmodconfig build failure
> but let me rerun it and see which module was using it.

Yeah, when building allmodconfig without this export I get:

ERROR: modpost: "__vma_start_write" [fs/ext4/ext4.ko] undefined!
ERROR: modpost: "__vma_start_write" [fs/cramfs/cramfs.ko] undefined!
ERROR: modpost: "__vma_start_write" [fs/fuse/fuse.ko] undefined!
ERROR: modpost: "__vma_start_write" [fs/orangefs/orangefs.ko] undefined!
ERROR: modpost: "__vma_start_write" [fs/xfs/xfs.ko] undefined!
ERROR: modpost: "__vma_start_write" [fs/erofs/erofs.ko] undefined!
ERROR: modpost: "__vma_start_write" [drivers/video/fbdev/core/fb.ko] undefined!
ERROR: modpost: "__vma_start_write" [drivers/acpi/pfr_telemetry.ko] undefined!
ERROR: modpost: "__vma_start_write" [drivers/dma/idxd/idxd.ko] undefined!
ERROR: modpost: "__vma_start_write" [drivers/xen/xen-gntdev.ko] undefined!

>
> >
> > > /*
> > > * Lookup and lock a VMA under RCU protection. Returned VMA is guaranteed to be
> > > * stable and not isolated. If the VMA is not found or is being modified the
> >