Re: [PATCH v5 68/70] mm: Remove the vma linked list
From: Liam Howlett
Date: Thu Feb 03 2022 - 12:25:54 EST
* Mark Hemment <markhemm@xxxxxxxxxxxxxx> [220203 07:08]:
> On Wed, 2 Feb 2022 at 02:43, Liam Howlett <liam.howlett@xxxxxxxxxx> wrote:
> >
> > From: "Liam R. Howlett" <Liam.Howlett@xxxxxxxxxx>
> >
> > Replace any vm_next use with vma_find().
> >
> > Update free_pgtables(), unmap_vmas(), and zap_page_range() to use the
> > maple tree.
> >
> > Use the new free_pgtables() and unmap_vmas() in do_mas_align_munmap().
> > At the same time, alter the loop to be more compact.
> >
> > Now that free_pgtables() and unmap_vmas() take a maple tree as an
> > argument, rearrange do_mas_align_munmap() to use the new tree to hold
> > the vmas to remove.
> >
> > Remove __vma_link_list() and __vma_unlink_list() as they are exclusively
> > used to update the linked list
> >
> > Drop linked list update from __insert_vm_struct().
> >
> > Rework validation of tree as it was depending on the linked list.
> >
> > Signed-off-by: Liam R. Howlett <Liam.Howlett@xxxxxxxxxx>
> > ---
> > include/linux/mm.h | 5 +-
> > include/linux/mm_types.h | 4 -
> > kernel/fork.c | 13 +-
> > mm/debug.c | 14 +-
> > mm/gup.c | 2 +-
> > mm/internal.h | 10 +-
> > mm/memory.c | 33 ++-
> > mm/mmap.c | 518 +++++++++++++++++----------------------
> > mm/nommu.c | 2 -
> > mm/util.c | 40 ---
> > 10 files changed, 264 insertions(+), 377 deletions(-)
> ...
> > -static inline int
> > -unlock_range(struct vm_area_struct *start, struct vm_area_struct **tail,
> > - unsigned long limit)
> > -{
> > - struct mm_struct *mm = start->vm_mm;
> > - struct vm_area_struct *tmp = start;
> > - int count = 0;
> > -
> > - while (tmp && tmp->vm_start < limit) {
> > - *tail = tmp;
> > - count++;
> > - if (tmp->vm_flags & VM_LOCKED) {
> > - mm->locked_vm -= vma_pages(tmp);
> > - munlock_vma_pages_all(tmp);
> > - }
> > -
> > - tmp = tmp->vm_next;
> > - }
> > -
> > - return count;
> > -}
>
> Trivial: Comment in exit_mmap(), for oom-victim case, has a reference
> to this removed function (unlock_range()).
>
Thanks, I will update the comment too.