Skip to content

Commit 7dec935

Browse files
committed
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: b75ef8b "Tracepoint: Dissociate from module mutex" Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
1 parent 12729f1 commit 7dec935

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎kernel/tracepoint.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,9 @@ static int tracepoint_module_coming(struct module *mod)
636636
struct tp_module *tp_mod, *iter;
637637
int ret = 0;
638638

639+
if (!mod->num_tracepoints)
640+
return 0;
641+
639642
/*
640643
* We skip modules that taint the kernel, especially those with different
641644
* 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)
679682
{
680683
struct tp_module *pos;
681684

685+
if (!mod->num_tracepoints)
686+
return 0;
687+
682688
mutex_lock(&tracepoints_mutex);
683689
tracepoint_update_probe_range(mod->tracepoints_ptrs,
684690
mod->tracepoints_ptrs + mod->num_tracepoints);

0 commit comments

Comments
 (0)