[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210817154651.1570984-35-Liam.Howlett@oracle.com>
Date: Tue, 17 Aug 2021 15:47:22 +0000
From: Liam Howlett <liam.howlett@...cle.com>
To: "maple-tree@...ts.infradead.org" <maple-tree@...ts.infradead.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>
CC: Song Liu <songliubraving@...com>,
Davidlohr Bueso <dave@...olabs.net>,
"Paul E . McKenney" <paulmck@...nel.org>,
Matthew Wilcox <willy@...radead.org>,
Laurent Dufour <ldufour@...ux.ibm.com>,
David Rientjes <rientjes@...gle.com>,
Axel Rasmussen <axelrasmussen@...gle.com>,
Suren Baghdasaryan <surenb@...gle.com>,
Vlastimil Babka <vbabka@...e.cz>,
Rik van Riel <riel@...riel.com>,
Peter Zijlstra <peterz@...radead.org>,
Michel Lespinasse <walken.cr@...il.com>,
Liam Howlett <liam.howlett@...cle.com>
Subject: [PATCH v2 34/61] fs/coredump: Use maple tree iterators in place of
linked list
From: "Liam R. Howlett" <Liam.Howlett@...cle.com>
Signed-off-by: Liam R. Howlett <Liam.Howlett@...cle.com>
---
fs/coredump.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/fs/coredump.c b/fs/coredump.c
index 4b3c75732c97..584a9742aa27 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -1063,10 +1063,10 @@ static unsigned long vma_dump_size(struct vm_area_struct *vma,
return vma->vm_end - vma->vm_start;
}
-static struct vm_area_struct *first_vma(struct task_struct *tsk,
+static struct vm_area_struct *first_vma(struct mm_struct *mm,
struct vm_area_struct *gate_vma)
{
- struct vm_area_struct *ret = tsk->mm->mmap;
+ struct vm_area_struct *ret = find_vma(mm, 0);
if (ret)
return ret;
@@ -1077,12 +1077,13 @@ static struct vm_area_struct *first_vma(struct task_struct *tsk,
* Helper function for iterating across a vma list. It ensures that the caller
* will visit `gate_vma' prior to terminating the search.
*/
-static struct vm_area_struct *next_vma(struct vm_area_struct *this_vma,
+static struct vm_area_struct *next_vma(struct mm_struct *mm,
+ struct vm_area_struct *this_vma,
struct vm_area_struct *gate_vma)
{
struct vm_area_struct *ret;
- ret = this_vma->vm_next;
+ ret = vma_next(mm, this_vma);
if (ret)
return ret;
if (this_vma == gate_vma)
@@ -1120,8 +1121,8 @@ int dump_vma_snapshot(struct coredump_params *cprm, int *vma_count,
return -ENOMEM;
}
- for (i = 0, vma = first_vma(current, gate_vma); vma != NULL;
- vma = next_vma(vma, gate_vma), i++) {
+ for (i = 0, vma = first_vma(mm, gate_vma); vma != NULL;
+ vma = next_vma(mm, vma, gate_vma), i++) {
struct core_vma_metadata *m = (*vma_meta) + i;
m->start = vma->vm_start;
--
2.30.2
Powered by blists - more mailing lists