From: Leon Hwang <hffilwlqm@gmail.com>
To: bpf@vger.kernel.org
Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
Leon Hwang <hffilwlqm@gmail.com>
Subject: [RFC PATCH bpf-next 0/2] bpf: Add generic kfunc bpf_ffs64()
Date: Wed, 31 Jan 2024 23:56:05 +0800 [thread overview]
Message-ID: <20240131155607.51157-1-hffilwlqm@gmail.com> (raw)
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
--
2.42.1
next reply other threads:[~2024-01-31 15:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-31 15:56 Leon Hwang [this message]
2024-01-31 15:56 ` [RFC PATCH bpf-next 1/2] bpf: Add generic kfunc bpf_ffs64() Leon Hwang
2024-01-31 15:56 ` [RFC PATCH bpf-next 2/2] selftests/bpf: Add testcases for " Leon Hwang
2024-02-02 22:18 ` [RFC PATCH bpf-next 0/2] bpf: Add " Andrii Nakryiko
2024-02-04 19:19 ` Yonghong Song
2024-02-05 18:18 ` Andrii Nakryiko
2024-02-05 18:34 ` Yonghong Song
2024-03-03 13:18 ` Leon Hwang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240131155607.51157-1-hffilwlqm@gmail.com \
--to=hffilwlqm@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox