[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250523083945.3390587-3-yebin@huaweicloud.com>
Date: Fri, 23 May 2025 16:39:45 +0800
From: Ye Bin <yebin@...weicloud.com>
To: rostedt@...dmis.org,
mhiramat@...nel.org,
mathieu.desnoyers@...icios.com,
mark.rutland@....com,
linux-trace-kernel@...r.kernel.org
Cc: linux-kernel@...r.kernel.org,
yebin10@...wei.com
Subject: [PATCH 2/2] ftrace: don't allocate ftrace module map
From: Ye Bin <yebin10@...wei.com>
If the ftrace is disabled, it is meaningless to allocate module map.
So add check in ftrace_free_mem().
Signed-off-by: Ye Bin <yebin10@...wei.com>
---
kernel/trace/ftrace.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index ff5d9d73a4a7..56adf45de92e 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -7824,6 +7824,11 @@ void ftrace_free_mem(struct module *mod, void *start_ptr, void *end_ptr)
mutex_lock(&ftrace_lock);
+ if (ftrace_disabled || (mod && !mod->num_ftrace_callsites)) {
+ mutex_unlock(&ftrace_lock);
+ return;
+ }
+
/*
* If we are freeing module init memory, then check if
* any tracer is active. If so, we need to save a mapping of
--
2.34.1
Powered by blists - more mailing lists