* + mm-mmapc-logic-of-find_vma_intersection-repeated-in-__do_munmap.patch added to -mm tree
@ 2021-05-10 5:08 akpm
0 siblings, 0 replies; only message in thread
From: akpm @ 2021-05-10 5:08 UTC (permalink / raw)
To: akpm, gmjuareztello, mm-commits
The patch titled
Subject: mm/mmap.c: logic of find_vma_intersection repeated in __do_munmap
has been added to the -mm tree. Its filename is
mm-mmapc-logic-of-find_vma_intersection-repeated-in-__do_munmap.patch
This patch should soon appear at
https://ozlabs.org/~akpm/mmots/broken-out/mm-mmapc-logic-of-find_vma_intersection-repeated-in-__do_munmap.patch
and later at
https://ozlabs.org/~akpm/mmotm/broken-out/mm-mmapc-logic-of-find_vma_intersection-repeated-in-__do_munmap.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: Gonzalo Matias Juarez Tello <gmjuareztello@gmail.com>
Subject: mm/mmap.c: logic of find_vma_intersection repeated in __do_munmap
Logic of find_vma_intersection() is repeated in __do_munmap().
Also, prev is assigned a value before checking vma->vm_start >= end which
might end up on a return statement making that assignment useless.
Calling find_vma_intersection() checks that condition and returns NULL if
no vma is found, hence only the !vma check is needed in __do_munmap().
Link: https://lkml.kernel.org/r/20210409162129.18313-1-gmjuareztello@gmail.com
Signed-off-by: Gonzalo Matias Juarez Tello <gmjuareztello@gmail.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/mmap.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
--- a/mm/mmap.c~mm-mmapc-logic-of-find_vma_intersection-repeated-in-__do_munmap
+++ a/mm/mmap.c
@@ -2828,16 +2828,11 @@ int __do_munmap(struct mm_struct *mm, un
*/
arch_unmap(mm, start, end);
- /* Find the first overlapping VMA */
- vma = find_vma(mm, start);
+ /* Find the first overlapping VMA where start < vma->vm_end */
+ vma = find_vma_intersection(mm, start, end);
if (!vma)
return 0;
prev = vma->vm_prev;
- /* we have start < vma->vm_end */
-
- /* if it doesn't overlap, we have nothing.. */
- if (vma->vm_start >= end)
- return 0;
/*
* If we need to split any vma, do it now to save pain later.
_
Patches currently in -mm which might be from gmjuareztello@gmail.com are
mm-mmapc-logic-of-find_vma_intersection-repeated-in-__do_munmap.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-10 5:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-10 5:08 + mm-mmapc-logic-of-find_vma_intersection-repeated-in-__do_munmap.patch added to -mm tree akpm
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.