Merge branch 'introduce bpf_strncmp() helper'
Hou Tao says:
====================
Hi,
The motivation for introducing bpf_strncmp() helper comes from
two aspects:
(1) clang doesn't always replace strncmp() automatically
In tracing program, sometimes we need to using a home-made
strncmp() to check whether or not the file name is expected.
(2) the performance of home-made strncmp is not so good
As shown in the benchmark in patch #4, the performance of
bpf_strncmp() helper is 18% or 33% better than home-made strncmp()
under x86-64 or arm64 when the compared string length is 64. When
the string length grows to 4095, the performance win will be
179% or 600% under x86-64 or arm64.
Any comments are welcome.
Regards,
Tao
Change Log:
v2:
* rebased on bpf-next
* drop patch "selftests/bpf: factor out common helpers for benchmarks"
(suggested by Andrii)
* remove unnecessary inline functions and add comments for programs which
will be rejected by verifier in patch 4 (suggested by Andrii)
* rename variables used in will-fail programs to clarify the purposes.
v1: https://lore.kernel.org/bpf/
20211130142215.1237217-1-houtao1@huawei.com
* change API to bpf_strncmp(const char *s1, u32 s1_sz, const char *s2)
* add benchmark refactor and benchmark between bpf_strncmp() and strncmp()
RFC: https://lore.kernel.org/bpf/
20211106132822.1396621-1-houtao1@huawei.com/
====================
Signed-off-by: Alexei Starovoitov <ast@kernel.org>