Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

arm64/lib: copy_page: use consistent prefetch stride

The optional prefetch instructions in the copy_page() routine are
inconsistent: at the start of the function, two cachelines are
prefetched beyond the one being loaded in the first iteration, but
in the loop, the prefetch is one more line ahead. This appears to
be unintentional, so let's fix it.

While at it, fix the comment style and white space.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>

authored by

Ard Biesheuvel and committed by
Will Deacon
288be97c ece4b206

+5 -4
+5 -4
arch/arm64/lib/copy_page.S
··· 30 30 */ 31 31 ENTRY(copy_page) 32 32 alternative_if ARM64_HAS_NO_HW_PREFETCH 33 - # Prefetch two cache lines ahead. 34 - prfm pldl1strm, [x1, #128] 35 - prfm pldl1strm, [x1, #256] 33 + // Prefetch three cache lines ahead. 34 + prfm pldl1strm, [x1, #128] 35 + prfm pldl1strm, [x1, #256] 36 + prfm pldl1strm, [x1, #384] 36 37 alternative_else_nop_endif 37 38 38 39 ldp x2, x3, [x1] ··· 51 50 subs x18, x18, #128 52 51 53 52 alternative_if ARM64_HAS_NO_HW_PREFETCH 54 - prfm pldl1strm, [x1, #384] 53 + prfm pldl1strm, [x1, #384] 55 54 alternative_else_nop_endif 56 55 57 56 stnp x2, x3, [x0]