Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wrap `bpf_map__reuse_fd` to reuse a BPF map accross BPF programs. This is useful in complex programs that long chains of calls, for example, via `bpf_tail_call` that may be loaded in different programs and share state via reused maps. Test Plan ========= Our global state map, called `heap` shared by multiple programs ``` [javierhonduco@fedora parca-agent]$ sudo bpftool map | grep heap 3403: percpu_array name heap flags 0x0 ``` ``` 2812: perf_event name walk_user_stacktrace_impl tag 25cb7e352f197144 gpl loaded_at 2023-08-01T16:06:01+0100 uid 0 xlated 7984B jited 4827B memlock 12288B map_ids 3399,3411,3401,3407,3400,3408,3409,3402,3406,3405,3403 btf_id 1993 pids parca-agent(1049424) metadata: name = "parca-agent (https://github.com/parca-dev/parca-agent)" 2814: perf_event name profile_cpu tag 3f2053ff90208ef1 gpl loaded_at 2023-08-01T16:06:02+0100 uid 0 xlated 4368B jited 2850B memlock 8192B map_ids 3411,3404,3399,3401,3408,3409,3405,3407,3403,3402 btf_id 1993 pids parca-agent(1049424) metadata: name = "parca-agent (https://github.com/parca-dev/parca-agent)" 2816: perf_event name walk_ruby_stack tag 97bb3ee23c47e22d gpl loaded_at 2023-08-01T16:06:02+0100 uid 0 xlated 87600B jited 56572B memlock 98304B map_ids 3413,3414,3419,3415,3399,3403,3420,3417,3418 btf_id 1994 pids parca-agent(1049424) ``` Map reuse will soon become a load loading functionality for Parca Agent. We are thoroughly testing it, across multiple kernels and with ASAN enabled, too. If there were any problems in the future we will quickly notice them and will be happy to submit bugfixes. Signed-off-by: Francisco Javier Honduvilla Coto <[email protected]>
- Loading branch information