]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mmap: Convert vma_expand() to use vma iterator
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Wed, 9 Nov 2022 16:30:19 +0000 (11:30 -0500)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Tue, 13 Dec 2022 20:58:34 +0000 (15:58 -0500)
Use the vma iterator instead of the maple state for type safety and for
consistency through the mm code.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
mm/mmap.c

index 6f71b4e5e3ad5c35f870c5b065a471422a3a573d..15464fc192337715488c304644fcfb2206a0c251 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -586,7 +586,7 @@ static int vma_link(struct mm_struct *mm, struct vm_area_struct *vma)
  *
  * Returns: 0 on success
  */
-inline int vma_expand(struct ma_state *mas, struct vm_area_struct *vma,
+inline int vma_expand(struct vma_iterator *vmi, struct vm_area_struct *vma,
                      unsigned long start, unsigned long end, pgoff_t pgoff,
                      struct vm_area_struct *next)
 {
@@ -615,7 +615,7 @@ inline int vma_expand(struct ma_state *mas, struct vm_area_struct *vma,
        /* Only handles expanding */
        VM_BUG_ON(vma->vm_start < start || vma->vm_end > end);
 
-       if (mas_preallocate(mas, vma, GFP_KERNEL))
+       if (vma_iter_prealloc(vmi, vma))
                goto nomem;
 
        vma_adjust_trans_huge(vma, start, end, 0);
@@ -640,8 +640,7 @@ inline int vma_expand(struct ma_state *mas, struct vm_area_struct *vma,
        vma->vm_start = start;
        vma->vm_end = end;
        vma->vm_pgoff = pgoff;
-       /* Note: mas must be pointing to the expanding VMA */
-       vma_mas_store(vma, mas);
+       vma_iter_store(vmi, vma);
 
        if (file) {
                vma_interval_tree_insert(vma, root);
@@ -2655,7 +2654,7 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
 
        /* Actually expand, if possible */
        if (vma &&
-           !vma_expand(&vmi.mas, vma, merge_start, merge_end, vm_pgoff, next)) {
+           !vma_expand(&vmi, vma, merge_start, merge_end, vm_pgoff, next)) {
                khugepaged_enter_vma(vma, vm_flags);
                goto expanded;
        }