Skip to content

RFC bpf: Add generic kfunc bpf_ffs64()

Leon Hwang bpf 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest2 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2bpf: Add generic kfunc bpf_ffs64()kernel/bpf/helpers.c+7 -00 replies
2/2selftests/bpf: Add testcases for generic kfunc bpf_ffs64()tools/testing/selftests/bpf/prog_tests/bitops.c tools/testing/selftests/bpf/progs/bitops.c+75 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH bpf-next 0/2] bpf: Add generic kfunc bpf_ffs64()

This patchset introduces a new generic kfunc bpf_ffs64(). This kfunc allows bpf to reuse kernel's __ffs64() function to improve ffs performance in bpf.

In patch "bpf: Add generic kfunc bpf_ffs64()", there is some data to confirm that this kfunc is able to save around 10ns for every time on "Intel(R) Xeon(R) Silver 4116 CPU @ 2.10GHz" CPU server, by comparing with bpf-implemented __ffs64().

However, it will be better when convert this kfunc to "rep bsf" in JIT on x86, which is able to avoid a call. But, I haven't figure out the way.

Leon Hwang (2):
bpf: Add generic kfunc bpf_ffs64() selftests/bpf: Add testcases for generic kfunc bpf_ffs64()

 kernel/bpf/helpers.c                          |  7 +++
 .../testing/selftests/bpf/prog_tests/bitops.c | 54 +++++++++++++++++++
 tools/testing/selftests/bpf/progs/bitops.c    | 21 ++++++++
 3 files changed, 82 insertions(+)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/bitops.c
 create mode 100644 tools/testing/selftests/bpf/progs/bitops.c

base-commit: c5809f0c308111adbcdbf95462a72fa79eb267d1

Signature · 1 line
2.42.1