Skip to content

Commit 40a292f

Browse files
ryanhrobwilldeacon
authored andcommitted
arm64: mm: Optimize range_split_to_ptes()
Enter lazy_mmu mode while splitting a range of memory to pte mappings. This causes barriers, which would otherwise be emitted after every pte (and pmd/pud) write, to be deferred until exiting lazy_mmu mode. For large systems, this is expected to significantly speed up fallback to pte-mapping the linear map for the case where the boot CPU has BBML2_NOABORT, but secondary CPUs do not. I haven't directly measured it, but this is equivalent to commit 1fcb7ce ("arm64: mm: Batch dsb and isb when populating pgtables"). Note that for the path from arch_kfence_init_pool(), we may sleep while allocating memory inside the lazy_mmu mode. Sleeping is not allowed by generic code inside lazy_mmu, but we know that the arm64 implementation is sleep-safe. So this is ok and follows the same pattern already used by split_kernel_leaf_mapping(). Signed-off-by: Ryan Roberts <ryan.roberts@arm.com> Reviewed-by: Yang Shi <yang@os.amperecomputing.com> Signed-off-by: Will Deacon <will@kernel.org>
1 parent ce2b3a5 commit 40a292f

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

arch/arm64/mm/mmu.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,8 +832,14 @@ static const struct mm_walk_ops split_to_ptes_ops = {
832832

833833
static int range_split_to_ptes(unsigned long start, unsigned long end, gfp_t gfp)
834834
{
835-
return walk_kernel_page_table_range_lockless(start, end,
835+
int ret;
836+
837+
arch_enter_lazy_mmu_mode();
838+
ret = walk_kernel_page_table_range_lockless(start, end,
836839
&split_to_ptes_ops, NULL, &gfp);
840+
arch_leave_lazy_mmu_mode();
841+
842+
return ret;
837843
}
838844

839845
static bool linear_map_requires_bbml2 __initdata;

0 commit comments

Comments
 (0)