]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
arm64/mm: Hoist barriers out of set_ptes_anysz() loop
authorRyan Roberts <ryan.roberts@arm.com>
Tue, 22 Apr 2025 08:18:14 +0000 (09:18 +0100)
committerWill Deacon <will@kernel.org>
Fri, 9 May 2025 12:43:07 +0000 (13:43 +0100)
commitf89b399e8d6e9fdef92b15164c2737ac8ef5831a
tree4f4fe9c602d2573c0ed5316727b114f801b8136b
parenta899b7d0673cc7c53545a4c9c30c2c93f2f8cc7d
arm64/mm: Hoist barriers out of set_ptes_anysz() loop

set_ptes_anysz() previously called __set_pte() for each PTE in the
range, which would conditionally issue a DSB and ISB to make the new PTE
value immediately visible to the table walker if the new PTE was valid
and for kernel space.

We can do better than this; let's hoist those barriers out of the loop
so that they are only issued once at the end of the loop. We then reduce
the cost by the number of PTEs in the range.

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
Tested-by: Luiz Capitulino <luizcap@redhat.com>
Link: https://lore.kernel.org/r/20250422081822.1836315-7-ryan.roberts@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/include/asm/pgtable.h