diff options
author | Daniel T. Lee <danieltimlee@gmail.com> | 2023-01-15 10:16:08 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2023-01-16 00:32:45 +0300 |
commit | 58e975d014e1e31bd1586be7d2be6d61bd3e3ada (patch) | |
tree | 6dddedfb3da5bfcd686fe1463f69e12e93469e68 /samples/bpf/test_overhead_raw_tp_kern.c | |
parent | 31b12a4159fae818ac1043539ec9656da57b2e2c (diff) | |
download | linux-58e975d014e1e31bd1586be7d2be6d61bd3e3ada.tar.xz |
samples/bpf: replace broken overhead microbenchmark with fib_table_lookup
The test_overhead bpf program is designed to compare performance
between tracepoint and kprobe. Initially it used task_rename and
urandom_read tracepoint.
However, commit 14c174633f34 ("random: remove unused tracepoints")
removed urandom_read tracepoint, and for this reason the test_overhead
got broken.
This commit introduces new microbenchmark using fib_table_lookup.
This microbenchmark sends UDP packets to localhost in order to invoke
fib_table_lookup.
In a nutshell:
fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
addr.sin_addr.s_addr = inet_addr(DUMMY_IP);
addr.sin_port = htons(DUMMY_PORT);
for() {
sendto(fd, buf, strlen(buf), 0,
(struct sockaddr *)&addr, sizeof(addr));
}
on 4 cpus in parallel:
lookup per sec
base (no tracepoints, no kprobes) 381k
with kprobe at fib_table_lookup() 325k
with tracepoint at fib:fib_table_lookup 330k
with raw_tracepoint at fib:fib_table_lookup 365k
Fixes: 14c174633f34 ("random: remove unused tracepoints")
Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
Link: https://lore.kernel.org/r/20230115071613.125791-6-danieltimlee@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'samples/bpf/test_overhead_raw_tp_kern.c')
-rw-r--r-- | samples/bpf/test_overhead_raw_tp_kern.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/samples/bpf/test_overhead_raw_tp_kern.c b/samples/bpf/test_overhead_raw_tp_kern.c index 8763181a32f3..3e29de0eca98 100644 --- a/samples/bpf/test_overhead_raw_tp_kern.c +++ b/samples/bpf/test_overhead_raw_tp_kern.c @@ -9,7 +9,7 @@ int prog(struct bpf_raw_tracepoint_args *ctx) return 0; } -SEC("raw_tracepoint/urandom_read") +SEC("raw_tracepoint/fib_table_lookup") int prog2(struct bpf_raw_tracepoint_args *ctx) { return 0; |