This version of the patchset rebases the changes on top of next (a1241b0). In comparison to v1, elf_functions_entry struct and related code is removed. Originally (even before I submitted v1) I used gobuffer to store a collection of elf_function-s. But that used too much memory, because gobuffer allocates big chunks, and these lists mostly contain just a few elements. This prompted me to switch to a list in v1. While rebasing I realized that we may avoid maintaining a mutex for each elf_functions_entry if list updates are made atomically. With that change it became obvious that elf_functions_entry abstraction is unnecessary, so I removed it. Also I removed reallocarray_grow logic, which was used for elf_functions->entries. I noticed that the number of functions (at least in vmlinux) is almost as big as the number of ELF symbols, and we can use this to pre-allocate the entire table and then adjust after function collection is complete. A patch splitting btf_encoder__collect_symbols became unnecessary and is removed. v1: https://lore.kernel.org/dwarves/20241004051347.41143-1-ihor.solodrai@xxxxx/ Ihor Solodrai (5): dwarf_loader: introduce pre/post cus__load_module hooks to conf_load btf_encoder: introduce elf_functions struct type btf_encoder: collect elf_functions in pre_cus__load_module btf_encoder: make elf_functions.entry an elf_function list btf_encoder: switch to shared elf_functions table btf_encoder.c | 364 ++++++++++++++++++++++++++++++++++--------------- btf_encoder.h | 5 +- dwarf_loader.c | 21 ++- dwarves.h | 18 ++- pahole.c | 28 ++-- 5 files changed, 307 insertions(+), 129 deletions(-) -- 2.43.0