public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tracing: kprobe-event: Return directly when dyn_event_list is empty
@ 2026-01-23  1:36 sunliming
  2026-01-24 17:02 ` Steven Rostedt
  0 siblings, 1 reply; 4+ messages in thread
From: sunliming @ 2026-01-23  1:36 UTC (permalink / raw)
  To: rostedt, mhiramat
  Cc: mathieu.desnoyers, linux-kernel, linux-trace-kernel, sunliming

From: sunliming <sunliming@kylinos.cn>

In enable_boot_kprobe_events(), it returns directly when dyn_event_list is
empty, thereby reducing the function's execution time. This function may
otherwise wait for the event_mutex lock for tens of milliseconds on certain
machines, which is unnecessary when dyn_event_list is empty.

Signed-off-by: sunliming <sunliming@kylinos.cn>
---
 kernel/trace/trace_kprobe.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 9953506370a5..d89a403c99d4 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -1982,6 +1982,9 @@ static __init void enable_boot_kprobe_events(void)
 	struct trace_kprobe *tk;
 	struct dyn_event *pos;
 
+	if (list_empty(&dyn_event_list))
+		return;
+
 	guard(mutex)(&event_mutex);
 	for_each_trace_kprobe(tk, pos) {
 		list_for_each_entry(file, &tr->events, list)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-01-26 14:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-23  1:36 [PATCH] tracing: kprobe-event: Return directly when dyn_event_list is empty sunliming
2026-01-24 17:02 ` Steven Rostedt
     [not found]   ` <01b1d5a3-8be0-4d9a-45d4-4da7c3edf746@linux.dev>
2026-01-26  4:21     ` Steven Rostedt
     [not found]       ` <78dbbd83-8de3-2031-6db7-036d0d8c11c5@linux.dev>
2026-01-26 14:38         ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox