On 31/7/26 07:17, Andrii Nakryiko wrote:
> On Tue, Jul 28, 2026 at 7:58 AM Leon Hwang <[email protected]> wrote:

[...]

>> +
>> +               if (char_at <= zero_at)
>> +                       return pos + char_at;
>> +               return nul_is_match ? pos + zero_at : -ENOENT;
>> +       }), err_out);
> 
> looking at the above code, I'd say it's just not worth it. Too much
> code and complexity, IMO. For the absolute majority of BPF programs
> this small speed up won't matter, while for those BPF programs where
> doing tons of bpf_strstr-like operations is the essence of those
> programs and has a huge impact on the performance, they can basically
> implement and maintain this complexity in their own code base.
> 


Agreed on the complexity concern.

Let's leave the str kfuncs as-is.

Thanks,
Leon

>> +
>> +       return pos == XATTR_SIZE_MAX ? -E2BIG : -ENOENT;
>> +
>> +err_out:
>> +       return -EFAULT;
>> +}
>> +
> 
> [...]


Reply via email to