Re: [PATCH v4] tracepoint: Do not fail unregistering a probe due to memory failure

From: Mathieu Desnoyers
Date: Wed Jan 27 2021 - 13:14:09 EST


----- On Jan 27, 2021, at 1:07 PM, rostedt rostedt@xxxxxxxxxxx wrote:

> On Wed, 27 Jan 2021 13:00:46 -0500 (EST)
> Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx> wrote:
>
>> > Instead of allocating a new array for removing a tracepoint, allocate twice
>> > the needed size when adding tracepoints to the array. On removing, use the
>> > second half of the allocated array. This removes the need to allocate memory
>> > for removing a tracepoint, as the allocation for removals will already have
>> > been done.
>>
>> I don't see how this can work reliably. AFAIU, with RCU, approaches
>> requiring a pre-allocation of twice the size and swapping to the alternate
>> memory area on removal falls apart whenever you remove 2 or more elements
>> back-to-back without waiting for a grace period.
>
> Good point ;-)
>
>>
>> How is this handled by your scheme ?
>
> I believe we can detect this case using the "prio" part of extra element,
> and force a rcu sync if there's back to back removals on the same
> tracepoint. That case does not happen often, so I'm hoping nobody will
> notice the slowdown with these syncs. I'll take a look at this.
>
> Thanks for bringing that up.

Requiring an RCU synchronize on element removal is quite intrusive, and can
be problematic if tracepoint removal is called from e.g. preempt-off context.

Thanks,

Mathieu

--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com