mm/mmap: change do_brk_munmap() to use do_mas_align_munmap()
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 6 Sep 2022 19:48:52 +0000 (19:48 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 27 Sep 2022 02:46:18 +0000 (19:46 -0700)
do_brk_munmap() has already aligned the address and has a maple tree state
to be used.  Use the new do_mas_align_munmap() to avoid unnecessary
alignment and error checks.

Link: https://lkml.kernel.org/r/20220906194824.2110408-30-Liam.Howlett@oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Tested-by: Yu Zhao <yuzhao@google.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: SeongJae Park <sj@kernel.org>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/mmap.c

index 6e587f4e3a7da50aadaff9c049e971a0b7cb4e87..8b7e9d5afd38c130b3510e92ce800bc8b888e8f4 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -3042,7 +3042,7 @@ static int do_brk_munmap(struct ma_state *mas, struct vm_area_struct *vma,
        int ret;
 
        arch_unmap(mm, newbrk, oldbrk);
-       ret = do_mas_munmap(mas, mm, newbrk, oldbrk-newbrk, uf, true);
+       ret = do_mas_align_munmap(mas, vma, mm, newbrk, oldbrk, uf, true);
        validate_mm_mt(mm);
        return ret;
 }