On Thu, Mar 21, 2024 at 11:05 AM Andrii Nakryiko <andrii@xxxxxxxxxx> wrote: > > > There are still ways to reduce number of "wasted" records further, this is > a problem that requires many small and rather independent steps. I feel this is a wrong path to follow. I think it would be better to introduce a flag for kprobe/fentry to do perf_snapshot_branch_stack() as early as possible and then bpf prog can copy these 16 or 32 8-byte entries at its leasure. Hacking all over the kernel and requiring bpf prog to call bpf_get_branch_snapshot() in the first few instructions looks like self inflicted pain.