Remove local kprobe event asynchronously. Note that this can asynchronously remove a kprobe_event part, but the perf_event needs to wait for all handlers finished before removing the local kprobe event. So from the perf_event (and eBPF) point of view, this shortens the trace termination process a bit, but it still takes O(n) time to finish it. To fix this issue, we need to change perf_event terminating process by decoupling "disable events" and "destroy events" as in ftrace. Signed-off-by: Masami Hiramatsu <mhiramat@xxxxxxxxxx> --- kernel/trace/trace_kprobe.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index f7e0370b10ae..e8c4828c21ae 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -1707,9 +1707,7 @@ void destroy_local_trace_kprobe(struct trace_event_call *event_call) return; } - __unregister_trace_kprobe(tk); - - free_trace_kprobe(tk); + __unregister_trace_kprobe_async(tk); } #endif /* CONFIG_PERF_EVENTS */