[PATCH v6 11/71] mm: Add VMA iterator

Mark Hemment markhemm at googlemail.com
Wed Feb 16 02:50:59 PST 2022


On Tue, 15 Feb 2022 at 14:43, Liam Howlett <liam.howlett at oracle.com> wrote:
>
> From: "Matthew Wilcox (Oracle)" <willy at infradead.org>
>
> 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.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy at infradead.org>
> Signed-off-by: Liam R. Howlett <Liam.Howlett at Oracle.com>
> Acked-by: Vlastimil Babka <vbabka at suse.cz>
> ---
>  include/linux/mm.h       | 31 +++++++++++++++++++++++++++++++
>  include/linux/mm_types.h | 21 +++++++++++++++++++++
>  mm/mmap.c                | 10 +++++-----
>  3 files changed, 57 insertions(+), 5 deletions(-)
>
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> +/* The MM code likes to work with exclusive end addresses */
> +#define for_each_vma_range(vmi, vma, end)                              \
> +       while ((vma = vma_find(&vmi, end - 1)) != NULL)
> +

Becareful of operator precedence; parentheses around "end'".

Cheers,
Masrk



More information about the maple-tree mailing list