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

From: Mark Hemment
Date: Wed Feb 16 2022 - 05:51:15 EST


On Tue, 15 Feb 2022 at 14:43, Liam Howlett <liam.howlett@xxxxxxxxxx> wrote:
>
> From: "Matthew Wilcox (Oracle)" <willy@xxxxxxxxxxxxx>
>
> 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@xxxxxxxxxxxxx>
> Signed-off-by: Liam R. Howlett <Liam.Howlett@xxxxxxxxxx>
> Acked-by: Vlastimil Babka <vbabka@xxxxxxx>
> ---
> 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