Re: [PATCH v8 14/21] mm/mmap: Avoid zeroing vma tree in mmap_region()

Lorenzo Stoakes
2024-10-02T18:54:59Z

[snip]

Also, for fun, try this one out. I don't hold out much hope, but just in case
the VMA iterator range being overly extended here might be a problem, let's see
if this makes a difference.

This is on top of the previous patch but hopefully should apply to clean too.

Thanks!

----8<----
From 01b0afe395664cdda313f87e2e9c6dd80fdf04e1 Mon Sep 17 00:00:00 2001
From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Date: Wed, 2 Oct 2024 19:52:08 +0100
Subject: [PATCH] hunch

---
mm/vma.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/mm/vma.h b/mm/vma.h
index 819f994cf727..20cb4f91e371 100644
--- a/mm/vma.h
+++ b/mm/vma.h
@@ -141,7 +141,8 @@ static inline int vma_iter_store_gfp(struct vma_iterator *vmi,

{
if (vmi->mas.status != ma_start &&
- ((vmi->mas.index > vma->vm_start) || (vmi->mas.last < vma->vm_start)))
+ ((vmi->mas.index > vma->vm_start) || (vmi->mas.last < vma->vm_start) ||
+ (vmi->mas.last > vma->vm_end)))
vma_iter_invalidate(vmi);

__mas_set_range(&vmi->mas, vma->vm_start, vma->vm_end - 1);
@@ -463,7 +464,8 @@ static inline void vma_iter_store(struct vma_iterator *vmi,
#endif

if (vmi->mas.status != ma_start &&
- ((vmi->mas.index > vma->vm_start) || (vmi->mas.last < vma->vm_start)))
+ ((vmi->mas.index > vma->vm_start) || (vmi->mas.last < vma->vm_start) ||
+ (vmi->mas.last > vma->vm_end)))
vma_iter_invalidate(vmi);

__mas_set_range(&vmi->mas, vma->vm_start, vma->vm_end - 1);
--
2.46.2