ebpf icon indicating copy to clipboard operation
ebpf copied to clipboard

prog: don't search for kmod when not needed

Open alban opened this issue 1 year ago • 3 comments

When using btfgen (to provide BTF information for kernels without BTF support), spec.LoadAndAssign() is called with opts.KernelTypes but without opts.KernelModuleTypes.

In this scenario, newProgramWithOptions() never makes use of kmod. Therefore we don't need to read /proc/kallsyms to find out the kmod implementing the symbol.

This patch removes the call to spec.KernelModule() in that case. This saves us about 10MB of memory allocation.

Related optimization: #1584

cc @burak-ok

alban avatar Oct 14 '24 14:10 alban