From: Liam R. Howlett Date: Mon, 22 Aug 2022 15:06:25 +0000 (+0000) Subject: fs/proc/base: use maple tree iterators in place of linked list X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=3fb57d7c9bab35d2438dbef61308840e68342d0a;p=users%2Fjedix%2Flinux-maple.git fs/proc/base: use maple tree iterators in place of linked list Link: https://lkml.kernel.org/r/20220822150128.1562046-43-Liam.Howlett@oracle.com Signed-off-by: Liam R. Howlett Cc: Catalin Marinas Cc: David Hildenbrand Cc: David Howells Cc: "Matthew Wilcox (Oracle)" Cc: SeongJae Park Cc: Sven Schnelle Cc: Vlastimil Babka Cc: Will Deacon Cc: Yu Zhao Signed-off-by: Andrew Morton --- diff --git a/fs/proc/base.c b/fs/proc/base.c index 93f7e3d971e4..0b72a6d8aac3 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -2350,6 +2350,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); @@ -2377,6 +2378,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: @@ -2388,7 +2390,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)