Re: [PATCH perf/core 08/22] uprobes/x86: Add mapping for optimized uprobe trampolines

Jiri Olsa
2025-04-28T13:52:38Z

On Sun, Apr 27, 2025 at 08:04:32PM +0200, Oleg Nesterov wrote:
> On 04/21, Jiri Olsa wrote:
> >
> > +struct uprobe_trampoline {
> > + struct hlist_node node;
> > + unsigned long vaddr;
> > + atomic64_t ref;
> > +};
>
> I don't really understand the point of uprobe_trampoline->ref...
>
> set_orig_insn/swbp_unoptimize paths don't call uprobe_trampoline_put().
> It is only called in unlikely case when swbp_optimize() fails, so perhaps
> we can kill this member and uprobe_trampoline_put() ? At least in the initial
> version.

right, we can remove that

>
> > +static void uprobe_trampoline_put(struct uprobe_trampoline *tramp)
> > +{
> > + if (tramp && atomic64_dec_and_test(&tramp->ref))
> > + destroy_uprobe_trampoline(tramp);
> > +}
>
> Why does it check tramp != NULL ?

I think some earlier version of the code could have called that with NULL,
will remove that

thanks,
jirka