tracing: Use queue_rcu_work() to free filters
authorSteven Rostedt <rostedt@goodmis.org>
Mon, 9 Jun 2025 17:17:32 +0000 (13:17 -0400)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Tue, 8 Jul 2025 22:17:29 +0000 (18:17 -0400)
commit3aceaa539cfe3a2e62bd92e6697d9fae1c20c0be
treee4b03b0984e5076fecef49563d573bbd3e0c6eff
parent88c79ecfb68fac057a0201db883518b662a0417d
tracing: Use queue_rcu_work() to free filters

Freeing of filters requires to wait for both an RCU grace period as well as
a RCU task trace wait period after they have been detached from their
lists. The trace task period can be quite large so the freeing of the
filters was moved to use the call_rcu*() routines. The problem with that is
that the callback functions of call_rcu*() is done from a soft irq and can
cause latencies if the callback takes a bit of time.

The filters are freed per event in a system and the syscalls system
contains an event per system call, which can be over 700 events. Freeing 700
filters in a bottom half is undesirable.

Instead, move the freeing to use queue_rcu_work() which is done in task
context.

Link: https://lore.kernel.org/all/9a2f0cd0-1561-4206-8966-f93ccd25927f@paulmck-laptop/
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Link: https://lore.kernel.org/20250609131732.04fd303b@gandalf.local.home
Fixes: a9d0aab5eb33 ("tracing: Fix regression of filter waiting a long time on RCU synchronization")
Suggested-by: "Paul E. McKenney" <paulmck@kernel.org>
Reviewed-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
kernel/trace/trace_events_filter.c