From: Yonghong Song <yonghong.song@linux.dev>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Kernel Team <kernel-team@fb.com>,
Martin KaFai Lau <martin.lau@kernel.org>
Subject: Re: [RFC PATCH bpf-next v2 2/2] [no_merge] selftests/bpf: Benchmark runtime performance with private stack
Date: Fri, 12 Jul 2024 13:48:39 -0700 [thread overview]
Message-ID: <d57143f9-de6c-49e8-af34-848ad9f19838@linux.dev> (raw)
In-Reply-To: <CAADnVQKnWJM7mGqpHn4wy25+VJuh9KGGK9tf75qgC2Zk8+ojBA@mail.gmail.com>
On 7/12/24 1:16 PM, Alexei Starovoitov wrote:
> On Thu, Jul 11, 2024 at 9:42 AM Yonghong Song <yonghong.song@linux.dev> wrote:
>>
>> It is clear that the main overhead is the push/pop r9 for
>> three calls.
>>
>> Five runs of the benchmarks:
>>
>> [root@arch-fb-vm1 bpf]# ./benchs/run_bench_private_stack.sh
>> no-private-stack: 0.662 ± 0.019M/s (drops 0.000 ± 0.000M/s)
>> private-stack: 0.673 ± 0.017M/s (drops 0.000 ± 0.000M/s)
>> [root@arch-fb-vm1 bpf]# ./benchs/run_bench_private_stack.sh
>> no-private-stack: 0.684 ± 0.005M/s (drops 0.000 ± 0.000M/s)
>> private-stack: 0.676 ± 0.008M/s (drops 0.000 ± 0.000M/s)
>> [root@arch-fb-vm1 bpf]# ./benchs/run_bench_private_stack.sh
>> no-private-stack: 0.673 ± 0.017M/s (drops 0.000 ± 0.000M/s)
>> private-stack: 0.683 ± 0.006M/s (drops 0.000 ± 0.000M/s)
>> [root@arch-fb-vm1 bpf]# ./benchs/run_bench_private_stack.sh
>> no-private-stack: 0.680 ± 0.011M/s (drops 0.000 ± 0.000M/s)
>> private-stack: 0.626 ± 0.050M/s (drops 0.000 ± 0.000M/s)
>> [root@arch-fb-vm1 bpf]# ./benchs/run_bench_private_stack.sh
>> no-private-stack: 0.686 ± 0.007M/s (drops 0.000 ± 0.000M/s)
>> private-stack: 0.683 ± 0.003M/s (drops 0.000 ± 0.000M/s)
>>
>> The performance is very similar between private-stack and no-private-stack.
> I'm not so sure.
> What is the "perf report" before/after?
> Are you sure that bench spends enough time inside the program itself?
> By the look of it it seems that most of the time will be in hashmap
> and syscall overhead.
>
> You need that batch's one that uses for loop and attached to a helper.
> See commit 7df4e597ea2c ("selftests/bpf: add batched, mostly in-kernel
> BPF triggering benchmarks")
Okay, I see. The current approach is one trigger, one prog run where
each prog run exercise 3 syscalls. I should add a loop to the bpf
program to make bpf program spends majority of time. Will do this
in the next revision, plus running 'perf report'.
>
> I think the next version doesn't need RFC tag. patch 1 lgtm.
next prev parent reply other threads:[~2024-07-12 20:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-11 16:42 [RFC PATCH bpf-next v2 1/2] bpf: Support private stack for bpf progs Yonghong Song
2024-07-11 16:42 ` [RFC PATCH bpf-next v2 2/2] [no_merge] selftests/bpf: Benchmark runtime performance with private stack Yonghong Song
2024-07-12 20:16 ` Alexei Starovoitov
2024-07-12 20:48 ` Yonghong Song [this message]
2024-07-12 21:47 ` Andrii Nakryiko
2024-07-12 23:42 ` Yonghong Song
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=d57143f9-de6c-49e8-af34-848ad9f19838@linux.dev \
--to=yonghong.song@linux.dev \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
--cc=martin.lau@kernel.org \
/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