mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-27 18:37:53 +07:00
e3edfdec04
the first microbenchmark does fd=open("/proc/self/comm"); for() { write(fd, "test"); } and on 4 cpus in parallel: writes per sec base (no tracepoints, no kprobes) 930k with kprobe at __set_task_comm() 420k with tracepoint at task:task_rename 730k For kprobe + full bpf program manully fetches oldcomm, newcomm via bpf_probe_read. For tracepint bpf program does nothing, since arguments are copied by tracepoint. 2nd microbenchmark does: fd=open("/dev/urandom"); for() { read(fd, buf); } and on 4 cpus in parallel: reads per sec base (no tracepoints, no kprobes) 300k with kprobe at urandom_read() 279k with tracepoint at random:urandom_read 290k bpf progs attached to kprobe and tracepoint are noop. Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
37 lines
828 B
C
37 lines
828 B
C
/* Copyright (c) 2016 Facebook
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of version 2 of the GNU General Public
|
|
* License as published by the Free Software Foundation.
|
|
*/
|
|
#include <uapi/linux/bpf.h>
|
|
#include "bpf_helpers.h"
|
|
|
|
/* from /sys/kernel/debug/tracing/events/task/task_rename/format */
|
|
struct task_rename {
|
|
__u64 pad;
|
|
__u32 pid;
|
|
char oldcomm[16];
|
|
char newcomm[16];
|
|
__u16 oom_score_adj;
|
|
};
|
|
SEC("tracepoint/task/task_rename")
|
|
int prog(struct task_rename *ctx)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
/* from /sys/kernel/debug/tracing/events/random/urandom_read/format */
|
|
struct urandom_read {
|
|
__u64 pad;
|
|
int got_bits;
|
|
int pool_left;
|
|
int input_left;
|
|
};
|
|
SEC("tracepoint/random/urandom_read")
|
|
int prog2(struct urandom_read *ctx)
|
|
{
|
|
return 0;
|
|
}
|
|
char _license[] SEC("license") = "GPL";
|