Skip to content

Commit

Permalink
tracepoint: Do not waste memory on mods with no tracepoints
Browse files Browse the repository at this point in the history
No reason to allocate tp_module structures for modules that have no
tracepoints. This just wastes memory.

Fixes: b75ef8b "Tracepoint: Dissociate from module mutex"
Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
rostedt committed Mar 4, 2014
1 parent 12729f1 commit 7dec935
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions kernel/tracepoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 7dec935

Please sign in to comment.