diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2022-06-21 20:46:54 +0000 |
---|---|---|
committer | Liam R. Howlett <Liam.Howlett@oracle.com> | 2022-07-19 20:01:57 -0400 |
commit | 44d9023feb7b23d825e31a17c0f797108a26bba7 (patch) | |
tree | cdd9ee81f7ce66670eeebe44e9632a76b22626bf /include/linux/mm_types.h | |
parent | a1e57593aae8c7e2301cfd4d2cb056e367fb6735 (diff) |
mm: add VMA iterator
This thin layer of abstraction over the maple tree state is for iterating
over VMAs. You can go forwards, go backwards or ask where the iterator
is. Rename the existing vma_next() to __vma_next() -- it will be removed
by the end of this series.
Link: https://lkml.kernel.org/r/20220504010716.661115-11-Liam.Howlett@oracle.com
Link: https://lkml.kernel.org/r/20220621204632.3370049-10-Liam.Howlett@oracle.com
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: David Hildenbrand <david@redhat.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: David Howells <dhowells@redhat.com>
Cc: SeongJae Park <sj@kernel.org>
Cc: Will Deacon <will@kernel.org>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'include/linux/mm_types.h')
-rw-r--r-- | include/linux/mm_types.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index e810aaca6c04..47fbff4d4502 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -696,6 +696,27 @@ static inline cpumask_t *mm_cpumask(struct mm_struct *mm) return (struct cpumask *)&mm->cpu_bitmap; } +struct vma_iterator { + struct ma_state mas; +}; + +#define VMA_ITERATOR(name, __mm, __addr) \ + struct vma_iterator name = { \ + .mas = { \ + .tree = &(__mm)->mm_mt, \ + .index = __addr, \ + .node = MAS_START, \ + }, \ + } + +static inline void vma_iter_init(struct vma_iterator *vmi, + struct mm_struct *mm, unsigned long addr) +{ + vmi->mas.tree = &mm->mm_mt; + vmi->mas.index = addr; + vmi->mas.node = MAS_START; +} + struct mmu_gather; extern void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm); extern void tlb_gather_mmu_fullmm(struct mmu_gather *tlb, struct mm_struct *mm); |