Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7dec935a authored by Steven Rostedt (Red Hat)'s avatar Steven Rostedt (Red Hat) Committed by Steven Rostedt
Browse files

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: b75ef8b4 "Tracepoint: Dissociate from module mutex"
Acked-by: default avatarMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent 12729f14
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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);