]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
mm/vmalloc: add vmap_range_noflush variant
authorNicholas Piggin <npiggin@gmail.com>
Fri, 30 Apr 2021 05:58:46 +0000 (22:58 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 30 Apr 2021 18:20:40 +0000 (11:20 -0700)
As a side-effect, the order of flush_cache_vmap() and
arch_sync_kernel_mappings() calls are switched, but that now matches the
other callers in this file.

Link: https://lkml.kernel.org/r/20210317062402.533919-13-npiggin@gmail.com
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Ding Tianhong <dingtianhong@huawei.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Uladzislau Rezki (Sony) <urezki@gmail.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/vmalloc.c

index 5c81717f7e0e0a2104bcb93fe9a3ba4a84e305da..41c1dbdd2677f40450e412f96cc2331ec843a37e 100644 (file)
@@ -240,7 +240,7 @@ static int vmap_p4d_range(pgd_t *pgd, unsigned long addr, unsigned long end,
        return 0;
 }
 
-int vmap_range(unsigned long addr, unsigned long end,
+static int vmap_range_noflush(unsigned long addr, unsigned long end,
                        phys_addr_t phys_addr, pgprot_t prot,
                        unsigned int max_page_shift)
 {
@@ -263,14 +263,24 @@ int vmap_range(unsigned long addr, unsigned long end,
                        break;
        } while (pgd++, phys_addr += (next - addr), addr = next, addr != end);
 
-       flush_cache_vmap(start, end);
-
        if (mask & ARCH_PAGE_TABLE_SYNC_MASK)
                arch_sync_kernel_mappings(start, end);
 
        return err;
 }
 
+int vmap_range(unsigned long addr, unsigned long end,
+                       phys_addr_t phys_addr, pgprot_t prot,
+                       unsigned int max_page_shift)
+{
+       int err;
+
+       err = vmap_range_noflush(addr, end, phys_addr, prot, max_page_shift);
+       flush_cache_vmap(addr, end);
+
+       return err;
+}
+
 static void vunmap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
                             pgtbl_mod_mask *mask)
 {