On Fri, 13 Dec 2019 16:35:53 +0100 Jiri Olsa <jolsa@xxxxxxxxxx> wrote: > I don't think dedup algorithm can handle this and I'm not sure if there's > some way in pahole to detect/prevent this. > > I only found that if I rename the ring_buffer objects to have distinct > names, it will help: > > $ bpftool btf dump file /sys/kernel/btf/vmlinux | grep task_struct > [150] STRUCT 'task_struct' size=11008 vlen=205 > > $ bpftool btf dump file /sys/kernel/btf/vmlinux | grep "STRUCT 'perf_event'" > [1665] STRUCT 'perf_event' size=1160 vlen=70 > > also the BTF data get smaller ;-) before: > > $ ll /sys/kernel/btf/vmlinux > -r--r--r--. 1 root root 2067432 Dec 13 22:56 /sys/kernel/btf/vmlinux > > after: > $ ll /sys/kernel/btf/vmlinux > -r--r--r--. 1 root root 1984345 Dec 13 23:02 /sys/kernel/btf/vmlinux > > > Peter, Steven, > if above is correct and there's no other better solution, would it be possible > to straighten up the namespace and user some distinct names for perf and ftrace > ring buffers? Now, the ring buffer that ftrace uses is not specific for ftrace or even tracing for that matter. It is a stand alone ring buffer (oprofile uses it), and can be used by anyone else. As the perf ring buffer is very coupled with perf (or perf events), and unless something changed, I was never able to pull the perf ring buffer out as a stand alone ring buffer. As the ring buffer in the tracing directory is more generic, and not to mention around longer, if one is to change the name, I would suggest it be the perf ring buffer. -- Steve