]> 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>
Tue, 21 Jun 2022 20:47:07 +0000 (20:47 +0000)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Wed, 20 Jul 2022 00:14:58 +0000 (20:14 -0400)
Link: https://lkml.kernel.org/r/20220504011345.662299-27-Liam.Howlett@oracle.com
Link: https://lkml.kernel.org/r/20220621204632.3370049-43-Liam.Howlett@oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: David Howells <dhowells@redhat.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: SeongJae Park <sj@kernel.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Will Deacon <will@kernel.org>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/proc/base.c

index 8dfa36a99c7421f629c9ccff36a7b7f0f5924ba2..617816168748078154db69b831d664321fabd3bd 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)