Re: [PATCH] lib/lz4: add software-pipelined prefetch to decode fast loop
From: Arnd Bergmann
Date: Wed Oct 14 2026 - 04:51:46 EST
On Tue, Oct 13, 2026, at 05:32, Andrew Morton wrote:
> On Tue, 13 Oct 2026 03:20:10 +0000 Biplab Raut <Biplab.Raut@xxxxxxx> wrote:
>>
>> Kernel LZ4 median scan: 1.0994 s
>> Patched median scan: 1.0472 s
>> Median paired speedup: 5.09% (range 4.19%–6.99%)
>> Patched was faster in all 15 rounds.
>
> Well that's nice. I can't actually recall a case where prefetch made a
> measurable difference, although I'm sure there are such cases.
>
> We used to use prefetches often (10+ years ago) but it seems to fallen
> out of favor. This code is a prime candidate. mm/ barely uses
> prefetch. Maybe it should,
Unfortunately the patch causes a build regression on x86 when using lz4
compressed bzImage files:
x86_64-linux-ld: error: unplaced orphan section `.altinstructions' from `arch/x86/boot/compressed/misc.o'
x86_64-linux-ld: error: unplaced orphan section `.altinstr_replacement' from `arch/x86/boot/compressed/misc.o'
I see that the zero-day bot has also reported this[1].
The problem is that the prefetch() helpers use SMP alternatives
that are not available in the decompressor. This has been a problem
in other patches before [2].
Not sure if there is an easy way to stop the decompressor from using
the alternatives here, for 7.4 I assume the only option is to drop
the patch and try again once that is resolved.
Arnd
[1] https://lore.kernel.org/all/202610140857.6jRIqXf1-lkp@xxxxxxxxx/
[2] https://lore.kernel.org/all/CAHk-=whrc-ruKs4Kt90EGzKd+pYhZFKs6bgBVCV=55BK+p1nzg@xxxxxxxxxxxxxx/