Re: [PATCH v2 10/11] perf/uprobe: Convert single-step and uretprobe to SRCU

From: Peter Zijlstra
Date: Mon Jul 15 2024 - 08:00:10 EST


On Fri, Jul 12, 2024 at 02:28:13PM -0700, Andrii Nakryiko wrote:

> > @@ -1814,7 +1822,7 @@ static int dup_utask(struct task_struct
> > return -ENOMEM;
> >
> > *n = *o;
> > - get_uprobe(n->uprobe);
> > + __srcu_clone_read_lock(&uretprobes_srcu, n->srcu_idx);
>
> do we need to add this __srcu_clone_read_lock hack just to avoid
> taking a refcount in dup_utask (i.e., on process fork)? This is not
> that frequent and performance-sensitive case, so it seems like it
> should be fine to take refcount and avoid doing srcu_read_unlock() in
> a new process. Just like the case with long-running uretprobes where
> you convert SRCU lock into refcount.

Yes, I suppose that is now possible too. But it makes the patches harder
to split. Let me ponder that after I get it to pass your stress thing.