aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2014-02-26 10:54:36 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-05-18 05:25:56 -0700
commit7bd3c53d12e0e454091ad35090410267af0e4a84 (patch)
tree98acc75a24ce0b6d632d2eb1daa8d510f3daea94
parent8ed40c122919cd79bc3c059e5864e5e7d9d455f0 (diff)
tracepoint: Do not waste memory on mods with no tracepoints
commit 7dec935a3aa04412cba2cebe1524ae0d34a30c24 upstream. No reason to allocate tp_module structures for modules that have no tracepoints. This just wastes memory. Fixes: b75ef8b44b1c "Tracepoint: Dissociate from module mutex" Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--kernel/tracepoint.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
index 23d8560dbc5..7840b3486db 100644
--- a/kernel/tracepoint.c
+++ b/kernel/tracepoint.c
@@ -638,6 +638,9 @@ static int tracepoint_module_coming(struct module *mod)
struct tp_module *tp_mod, *iter;
int ret = 0;
+ if (!mod->num_tracepoints)
+ return 0;
+
/*
* We skip modules that taint the kernel, especially those with different
* module headers (for forced load), to make sure we don't cause a crash.
@@ -681,6 +684,9 @@ static int tracepoint_module_going(struct module *mod)
{
struct tp_module *pos;
+ if (!mod->num_tracepoints)
+ return 0;
+
mutex_lock(&tracepoints_mutex);
tracepoint_update_probe_range(mod->tracepoints_ptrs,
mod->tracepoints_ptrs + mod->num_tracepoints);