Re: [RFC][PATCH 03/14 v2] function_graph: Allow multiple users to attach to function graph

From: Steven Rostedt
Date: Fri May 24 2019 - 09:00:48 EST


On Fri, 24 May 2019 14:27:24 +0200
Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:

> > Believe me, I rather not have that array, but I couldn't come up with a
> > better solution to handle freeing of fgraph_ops.
>
> The trivial answer would be to refcount the thing, but can't we make
> rcu_tasks do this?

But wouldn't refcounts require atomic operations, something that would
be excruciatingly slow for something that runs on all functions.

rcu_tasks doesn't cross voluntary sleeps, which this does.

>
> And delay the unreg until all active users are gone -- who gives a crap
> that can take a while.

It could literally be forever (well, until the machine reboots). And
something that could appear to be a memory leak, although a very slow
one. But probably be hard to have more than the number of tasks on the
system.

-- Steve