BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/3] bpf: inline bpf_kptr_xchg()
@ 2023-12-19 13:56 Hou Tao
  2023-12-19 13:56 ` [PATCH bpf-next 1/3] bpf: Support inlining bpf_kptr_xchg() helper Hou Tao
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Hou Tao @ 2023-12-19 13:56 UTC (permalink / raw)
  To: bpf
  Cc: Martin KaFai Lau, Alexei Starovoitov, Andrii Nakryiko, Song Liu,
	Hao Luo, Yonghong Song, Daniel Borkmann, KP Singh,
	Stanislav Fomichev, Jiri Olsa, John Fastabend, houtao1

From: Hou Tao <houtao1@huawei.com>

Hi,

The motivation for the patch set comes from the performance profiling of
bpf memory allocator benchmark (will post it soon). The initial purpose
of the benchmark is used to test whether or not there is performance
degradation when using c->unit_size instead of ksize() to select the
target cache for free [1]. The benchmark uses bpf_kptr_xchg() to stash
the allocated objects and fetches the stashed objects for free. Based on
the fix proposed in [1], After inling bpf_kptr_xchg(), the performance
for object free increase about ~4%.

Initially the inline is implemented in do_jit() for x86-64 directly, but
I think it will more portable to implement the inline in verifier.
Please see individual patches for more details. And comments are always
welcome.

[1]: https://lore.kernel.org/bpf/20231216131052.27621-1-houtao@huaweicloud.com

Hou Tao (3):
  bpf: Support inlining bpf_kptr_xchg() helper
  bpf, x86: Don't generate lock prefix for BPF_XCHG
  bpf, x86: Inline bpf_kptr_xchg() on x86-64

 arch/x86/net/bpf_jit_comp.c |  9 ++++++++-
 include/linux/filter.h      |  1 +
 kernel/bpf/core.c           | 10 ++++++++++
 kernel/bpf/verifier.c       | 17 +++++++++++++++++
 4 files changed, 36 insertions(+), 1 deletion(-)

-- 
2.29.2


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2023-12-23  4:01 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-19 13:56 [PATCH bpf-next 0/3] bpf: inline bpf_kptr_xchg() Hou Tao
2023-12-19 13:56 ` [PATCH bpf-next 1/3] bpf: Support inlining bpf_kptr_xchg() helper Hou Tao
2023-12-20 15:02   ` Daniel Borkmann
2023-12-20 17:07   ` Eduard Zingerman
2023-12-21 11:40     ` Hou Tao
2023-12-19 13:56 ` [PATCH bpf-next 2/3] bpf, x86: Don't generate lock prefix for BPF_XCHG Hou Tao
2023-12-20 14:58   ` Daniel Borkmann
2023-12-20 18:25     ` Alexei Starovoitov
2023-12-20 18:46       ` Daniel Borkmann
2023-12-21 11:37         ` Hou Tao
2023-12-23  4:01           ` Hou Tao
2023-12-19 13:56 ` [PATCH bpf-next 3/3] bpf, x86: Inline bpf_kptr_xchg() on x86-64 Hou Tao
2023-12-20 14:54 ` [PATCH bpf-next 0/3] bpf: inline bpf_kptr_xchg() Daniel Borkmann
2023-12-21 11:32   ` Hou Tao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox