ebpf
                                
                                 ebpf copied to clipboard
                                
                                    ebpf copied to clipboard
                            
                            
                            
                        prog: don't search for kmod when not needed
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