[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220829212531.3184856-16-surenb@google.com>
Date: Mon, 29 Aug 2022 21:25:18 +0000
From: Suren Baghdasaryan <surenb@...gle.com>
To: akpm@...ux-foundation.org
Cc: michel@...pinasse.org, jglisse@...gle.com, mhocko@...e.com,
vbabka@...e.cz, hannes@...xchg.org, mgorman@...hsingularity.net,
dave@...olabs.net, willy@...radead.org, liam.howlett@...cle.com,
peterz@...radead.org, ldufour@...ux.ibm.com,
laurent.dufour@...ibm.com, paulmck@...nel.org, riel@...riel.com,
luto@...nel.org, songliubraving@...com, peterx@...hat.com,
david@...hat.com, dhowells@...hat.com, hughd@...gle.com,
bigeasy@...utronix.de, kent.overstreet@...ux.dev,
rientjes@...gle.com, axelrasmussen@...gle.com, joelaf@...gle.com,
minchan@...gle.com, surenb@...gle.com, kernel-team@...roid.com,
linux-mm@...ck.org, linux-arm-kernel@...ts.infradead.org,
linuxppc-dev@...ts.ozlabs.org, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [RFC PATCH 15/28] mm/mmap: mark adjacent VMAs as locked if they can
grow into unmapped area
While unmapping VMAs, adjacent VMAs might be able to grow into the area
being unmapped. In such cases mark adjacent VMAs as locked to prevent
this growth.
Signed-off-by: Suren Baghdasaryan <surenb@...gle.com>
---
mm/mmap.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/mm/mmap.c b/mm/mmap.c
index b0d78bdc0de0..b31cc97c2803 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2680,10 +2680,14 @@ detach_vmas_to_be_unmapped(struct mm_struct *mm, struct vm_area_struct *vma,
* VM_GROWSUP VMA. Such VMAs can change their size under
* down_read(mmap_lock) and collide with the VMA we are about to unmap.
*/
- if (vma && (vma->vm_flags & VM_GROWSDOWN))
+ if (vma && (vma->vm_flags & VM_GROWSDOWN)) {
+ vma_mark_locked(vma);
return false;
- if (prev && (prev->vm_flags & VM_GROWSUP))
+ }
+ if (prev && (prev->vm_flags & VM_GROWSUP)) {
+ vma_mark_locked(prev);
return false;
+ }
return true;
}
--
2.37.2.672.g94769d06f0-goog
Powered by blists - more mailing lists