]> 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>
Thu, 14 Apr 2022 06:07:19 +0000 (23:07 -0700)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Tue, 26 Apr 2022 14:36:39 +0000 (10:36 -0400)
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
fs/proc/base.c

index c1031843cc6aa43a13eb4e0fc5b1a2e26d9eed93..bf85b85cd5722851e75d1fab125ee9086f569a1a 100644 (file)
@@ -2322,6 +2322,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);
 
@@ -2349,6 +2350,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:
@@ -2360,7 +2362,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)