Re: [PATCH bpf-next v3] bpf: make the attach target more accurate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 14, 2025 at 2:50 PM Menglong Dong <menglong.dong@xxxxxxxxx> wrote:
>
>
> On 2025/7/15 03:52, Alexei Starovoitov wrote:
> > On Thu, Jul 10, 2025 at 12:10 AM Menglong Dong <menglong8.dong@xxxxxxxxx> wrote:
> >>                          } else {
> >> -                               addr = kallsyms_lookup_name(tname);
> >> +                               ret = bpf_lookup_attach_addr(NULL, tname, &addr);
> >>                          }
> > Not sure why your benchmarking doesn't show the difference,
> > but above is a big regression.
> > kallsyms_lookup_name() is a binary search whereas your
> > bpf_lookup_attach_addr() is linear.
> > You should see a massive degradation in multi-kprobe attach speeds.
>
>
> Hi, Alexei. Like I said above, the benchmarking does have
> a difference for the symbol in the modules, which makes
> the attachment time increased from 0.135543s to 0.176904s
> for 8631 symbols. As the symbols in the modules
> is not plentiful, which makes the overhead slight(or not?).
>
> But for the symbol in vmlinux, bpf_lookup_attach_addr() will
> call kallsyms_on_each_match_symbol(), which is also
> a binary search, so the benchmarking has no difference,
> which makes sense.

I see.
Just curious, what was the function count in modules on your system ?
cat /proc/kallsyms|grep '\['|grep -v bpf|wc -l

Only now I read the diff carefully enough to realize that
you're looking for duplicates across vmlinux and that one module.

Why ?
BTF based attachment identifies a specific module.
Even if there are dups between that module and vmlinux the attachment
is not ambiguous.

> I thought we don't need this patch after the pahole fixes this
> problem. Should I send a V4?

pahole should fix it, so this change is not needed.
But pahole will be removing the dups within vmlinux and
within each module independently. Not across them.
I don't think "across" is needed, but you somehow believe that
it's necessary ? (based on this diff)





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux