Re: [PATCH] MIPS: lib: prefetch ahead in csum_partial()
From: Maciej W. Rozycki
Date: Sun Oct 18 2026 - 19:14:58 EST
On Fri, 9 Oct 2026, Rosen Penev wrote:
> diff --git a/arch/mips/lib/csum_partial.S b/arch/mips/lib/csum_partial.S
> index 3d2ff4118d79..f0ec47259ef4 100644
> --- a/arch/mips/lib/csum_partial.S
> +++ b/arch/mips/lib/csum_partial.S
> @@ -190,6 +190,21 @@ EXPORT_SYMBOL(csum_partial)
> andi t2, a1, 0x40
>
> .Lmove_128bytes:
> +#ifdef CONFIG_CPU_HAS_PREFETCH
> + /*
> + * Fetch the block two iterations ahead, but only while it lies
> + * inside the buffer: on non-coherent systems a line prefetched
> + * past the end could belong to a buffer the device still owns.
> + */
> + sltiu t5, t8, 3
> + bnez t5, 2f
> + nop
I don't like this manual delay slot scheduling, but it seems like a case
for a larger clean-up of this file, so I'd be inclined to accept it.
> + pref 0, 0x100(src)
> + pref 0, 0x120(src)
> + pref 0, 0x140(src)
> + pref 0, 0x160(src)
What about MIPSr6 though, which only has a span of -256..255 for the
immediate offset in the machine instruction here?
Maciej