Re: [PATCH RFC 1/9] lib/lz4: import upstream LZ4 sources verbatim
From: Michal Wilczynski
Date: Sat Oct 03 2026 - 19:35:29 EST
On 9/28/26 06:12, Sergey Senozhatsky wrote:
> On (26/09/25 13:27), Michal Wilczynski wrote:
> [..]
>> +#ifndef LZ4_FAST_DEC_LOOP
>> +# if defined __i386__ || defined _M_IX86 || defined __x86_64__ || defined _M_X64
>> +# define LZ4_FAST_DEC_LOOP 1
>> +# elif defined(__aarch64__) && defined(__APPLE__)
>> +# define LZ4_FAST_DEC_LOOP 1
>> +# elif defined(__aarch64__) && !defined(__clang__)
>> + /* On non-Apple aarch64, we disable this optimization for clang because
>> + * on certain mobile chipsets, performance is reduced with clang. For
>> + * more information refer to https://protect2.fireeye.com/v1/url?k=e59d343e-8402d40e-e59cbf71-000babe403ab-24cad800d51083a3&q=1&e=1265adcb-d286-42f9-9d57-b9b998ba2ed0&u=https%3A%2F%2Fgithub.com%2Flz4%2Flz4%2Fpull%2F707 */
>> +# define LZ4_FAST_DEC_LOOP 1
>> +# else
>> +# define LZ4_FAST_DEC_LOOP 0
>> +# endif
>> +#endif
>
> I just checked https://protect2.fireeye.com/v1/url?k=f36de8be-92f2088e-f36c63f1-000babe403ab-1972efa3caab0762&q=1&e=1265adcb-d286-42f9-9d57-b9b998ba2ed0&u=https%3A%2F%2Fgithub.com%2Flz4%2Flz4%2Fpull%2F707 and it seems that
> LZ4_FAST_DEC_LOOP is enabled on aarch64 now, but we still disable it.
> Am I missing something?
>
You're right for clang builds. v1.10.0 enables the fast loop on aarch64
only with GCC clang has been excluded since PR you mentioned. Upstream
has since changed that neither of those commits is released yet:
0aa33884faf5 ("[LZ4] Limit disabling LZ4_FAST_DEC_LOOP to
aarch64+clang+android")
ed86bc1ed802 ("AArch64: Enable LZ4_FAST_DEC_LOOP for Android")
The first is already enough for the kernel.
For v2 I'll backport both commits into the vendored lz4.c the same
way patch 2 backports 5ef1f16929b5. They apply cleanly in order and
give exactly upstream's current condition, and they go away at the next
resync.
Best regards,
--
Michal Wilczynski <m.wilczynski@xxxxxxxxxxx>