Skip to contentSkip to conversation

selftests/bpf: Add perfbuf multi-producer benchmark

PATCH Applied Gyutae Bae 2 participants 2 messages Jan 20

Subsystems (3)
lore
Share & tools
lore

Gyutae Bae

author
#0 lore raw

PATCH 1/1 selftests/bpf: Add perfbuf multi-producer benchmark

From: Gyutae Bae <[email protected]>

Add a multi-producer benchmark for perfbuf to complement the existing ringbuf multi-producer test. Unlike ringbuf which uses a shared buffer and experiences contention, perfbuf uses per-CPU buffers so the test measures scaling behavior rather than contention.

This allows developers to compare perfbuf vs ringbuf performance under multi-producer workloads when choosing between the two for their systems.

---
 tools/testing/selftests/bpf/benchs/run_bench_ringbufs.sh | 5 +++++
 1 file changed, 5 insertions(+)
tools/testing/selftests/bpf/benchs/run_bench_ringbufs.sh +5 -0
index 83e05e837871..123b7feb6935 100755
@@ -49,6 +49,11 @@ for b in 1 2 3 4 8 12 16 20 24 28 32 36 40 44 48 52; do
 	summarize "rb-libbpf nr_prod $b" "$($RUN_RB_BENCH -p$b --rb-batch-cnt 50 rb-libbpf)"
 done
 
+header "Perfbuf, multi-producer"
+for b in 1 2 3 4 8 12 16 20 24 28 32 36 40 44 48 52; do
+	summarize "pb-libbpf nr_prod $b" "$($RUN_RB_BENCH -p$b --rb-batch-cnt 50 --rb-sample-rate 50 pb-libbpf)"
+done
+
 header "Ringbuf, multi-producer contention in overwrite mode, no consumer"
 for b in 1 2 3 4 8 12 16 20 24 28 32 36 40 44 48 52; do
 	summarize "rb-prod nr_prod $b" "$($RUN_BENCH -p$b --rb-batch-cnt 50 --rb-overwrite --rb-bench-producer rb-libbpf)"
Signature · 1 line
2.39.5 (Apple Git-154)
#1 lore raw
This patch was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <[email protected]>:

Hello:

This patch was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <[email protected]>:

Quoted 8 lines · On Tue, 20 Jan 2026 18:07:16 +0900 you wrote:

From: Gyutae Bae <[email protected]>

Add a multi-producer benchmark for perfbuf to complement the existing ringbuf multi-producer test. Unlike ringbuf which uses a shared buffer and experiences contention, perfbuf uses per-CPU buffers so the test measures scaling behavior rather than contention.

[...]

Here is the summary with links:
- selftests/bpf: Add perfbuf multi-producer benchmark

    https://git.kernel.org/bpf/bpf-next/c/2e6690d4f7fc

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html