summaryrefslogtreecommitdiffstats
path: root/kernel/tracepoint.c
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2014-02-26 10:54:36 -0500
committerSteven Rostedt <rostedt@goodmis.org>2014-03-03 21:23:08 -0500
commit7dec935a3aa04412cba2cebe1524ae0d34a30c24 (patch)
tree5fb2530f811f78cfa65310d0936975fbb90b0de8 /kernel/tracepoint.c
parent12729f14d8357fb845d75155228b21e76360272d (diff)
downloadlinux-7dec935a3aa04412cba2cebe1524ae0d34a30c24.tar.gz
linux-7dec935a3aa04412cba2cebe1524ae0d34a30c24.tar.bz2
linux-7dec935a3aa04412cba2cebe1524ae0d34a30c24.zip
tracepoint: Do not waste memory on mods with no tracepoints
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>
Diffstat (limited to 'kernel/tracepoint.c')
-rw-r--r--kernel/tracepoint.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
index 29f26540e9c9..0d4ef26574ff 100644
--- a/kernel/tracepoint.c
+++ b/kernel/tracepoint.c
@@ -636,6 +636,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.
@@ -679,6 +682,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);