From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mathieu Desnoyers , Steven Rostedt Subject: [PATCH 3.4 7/9] tracepoint: Do not waste memory on mods with no tracepoints Date: Fri, 16 May 2014 15:55:30 -0700 Message-Id: <20140516225458.861132453@linuxfoundation.org> In-Reply-To: <20140516225458.512693003@linuxfoundation.org> References: <20140516225458.512693003@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: 3.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: "Steven Rostedt (Red Hat)" 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 Signed-off-by: Steven Rostedt Signed-off-by: Greg Kroah-Hartman --- kernel/tracepoint.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/kernel/tracepoint.c +++ b/kernel/tracepoint.c @@ -638,6 +638,9 @@ static int tracepoint_module_coming(stru 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(struc { 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);