]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
fs/proc/base: Use maple tree iterators in place of linked list
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Mon, 4 Jan 2021 19:46:23 +0000 (14:46 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Thu, 28 Jan 2021 02:00:46 +0000 (21:00 -0500)
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
fs/proc/base.c

index f52217f432bc1bcb227c6699e2d88397536da47c..e55ecd42642bccc23c53356bdb0d94d73f853bde 100644 (file)
@@ -2313,6 +2313,7 @@ proc_map_files_readdir(struct file *file, struct dir_context *ctx)
        GENRADIX(struct map_files_info) fa;
        struct map_files_info *p;
        int ret;
+       MA_STATE(mas, NULL, 0, 0);
 
        genradix_init(&fa);
 
@@ -2340,6 +2341,7 @@ proc_map_files_readdir(struct file *file, struct dir_context *ctx)
        }
 
        nr_files = 0;
+       mas.tree = &mm->mm_mt;
 
        /*
         * We need two passes here:
@@ -2351,7 +2353,8 @@ proc_map_files_readdir(struct file *file, struct dir_context *ctx)
         * routine might require mmap_lock taken in might_fault().
         */
 
-       for (vma = mm->mmap, pos = 2; vma; vma = vma->vm_next) {
+       pos = 2;
+       mas_for_each(&mas, vma, ULONG_MAX) {
                if (!vma->vm_file)
                        continue;
                if (++pos <= ctx->pos)