linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2] mm/mmap.c: lines in __do_munmap repeat logic of inlined find_vma_intersection
@ 2021-04-08  3:46 Gonzalo Matias Juarez Tello
  2021-04-14 15:16 ` David Hildenbrand
  0 siblings, 1 reply; 2+ messages in thread
From: Gonzalo Matias Juarez Tello @ 2021-04-08  3:46 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, linux-kernel

Some lines in __do_munmap used the same logic as find_vma_intersection
(which is inlined) instead of directly using that function.

(Can't believe I made a typo in the first one, compiled this one,
sorry first patch kinda nervous for some reason)

Signed-off-by: Gonzalo Matias Juarez Tello <gmjuareztello@gmail.com>
---
 mm/mmap.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 3f287599a7a3..1b29f8bf8344 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2823,15 +2823,10 @@ int __do_munmap(struct mm_struct *mm, unsigned long start, size_t len,
 	arch_unmap(mm, start, end);
 
 	/* Find the first overlapping VMA */
-	vma = find_vma(mm, start);
+	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.
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCHv2] mm/mmap.c: lines in __do_munmap repeat logic of inlined find_vma_intersection
  2021-04-08  3:46 [PATCHv2] mm/mmap.c: lines in __do_munmap repeat logic of inlined find_vma_intersection Gonzalo Matias Juarez Tello
@ 2021-04-14 15:16 ` David Hildenbrand
  0 siblings, 0 replies; 2+ messages in thread
From: David Hildenbrand @ 2021-04-14 15:16 UTC (permalink / raw)
  To: Gonzalo Matias Juarez Tello, akpm; +Cc: linux-mm, linux-kernel

On 08.04.21 05:46, Gonzalo Matias Juarez Tello wrote:
> Some lines in __do_munmap used the same logic as find_vma_intersection
> (which is inlined) instead of directly using that function.
> 
> (Can't believe I made a typo in the first one, compiled this one,
> sorry first patch kinda nervous for some reason)
> 
> Signed-off-by: Gonzalo Matias Juarez Tello <gmjuareztello@gmail.com>
> ---
>   mm/mmap.c | 7 +------
>   1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 3f287599a7a3..1b29f8bf8344 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -2823,15 +2823,10 @@ int __do_munmap(struct mm_struct *mm, unsigned long start, size_t len,
>   	arch_unmap(mm, start, end);
>   
>   	/* Find the first overlapping VMA */
> -	vma = find_vma(mm, start);
> +	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.
> 

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 
Thanks,

David / dhildenb



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-14 15:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-08  3:46 [PATCHv2] mm/mmap.c: lines in __do_munmap repeat logic of inlined find_vma_intersection Gonzalo Matias Juarez Tello
2021-04-14 15:16 ` David Hildenbrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).