Skip to content

Commit 2cdfe39

Browse files
Yaxiong Tianrostedt
authored andcommitted
tracing/kprobes: Skip setup_boot_kprobe_events() when no cmdline event
When the 'kprobe_event=' kernel command-line parameter is not provided, there is no need to execute setup_boot_kprobe_events(). This change optimizes the initialization function init_kprobe_trace() by skipping unnecessary work and effectively prevents potential blocking that could arise from contention on the event_mutex lock in subsequent operations. Link: https://patch.msgid.link/20260204015401.163748-1-tianyaxiong@kylinos.cn Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Signed-off-by: Yaxiong Tian <tianyaxiong@kylinos.cn> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent 0c2580a commit 2cdfe39

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

kernel/trace/trace_kprobe.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2048,6 +2048,10 @@ static __init int init_kprobe_trace(void)
20482048
trace_create_file("kprobe_profile", TRACE_MODE_READ,
20492049
NULL, NULL, &kprobe_profile_ops);
20502050

2051+
/* If no 'kprobe_event=' cmd is provided, return directly. */
2052+
if (kprobe_boot_events_buf[0] == '\0')
2053+
return 0;
2054+
20512055
setup_boot_kprobe_events();
20522056

20532057
return 0;

0 commit comments

Comments
 (0)