Patchwork [3.11.y.z,extended,stable] Patch "tracepoint: Do not waste memory on mods with no tracepoints" has been added to staging queue

login
register
mail settings
Submitter Luis Henriques
Date May 14, 2014, 2:58 p.m.
Message ID <1400079491-17105-1-git-send-email-luis.henriques@canonical.com>
Download mbox | patch
Permalink /patch/348832/
State New
Headers show

Comments

Luis Henriques - May 14, 2014, 2:58 p.m.
This is a note to let you know that I have just added a patch titled

    tracepoint: Do not waste memory on mods with no tracepoints

to the linux-3.11.y-queue branch of the 3.11.y.z extended stable tree 
which can be found at:

 http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.11.y-queue

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.11.y.z tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Luis

------

From 752fa1815a6798649ca58660d1b5cdc76ff3ee3d Mon Sep 17 00:00:00 2001
From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
Date: Wed, 26 Feb 2014 10:54:36 -0500
Subject: tracepoint: Do not waste memory on mods with no tracepoints

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 <mathieu.desnoyers@efficios.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 kernel/tracepoint.c | 6 ++++++
 1 file changed, 6 insertions(+)

--
1.9.1

Patch

diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
index 031cc56..63630ae 100644
--- a/kernel/tracepoint.c
+++ b/kernel/tracepoint.c
@@ -641,6 +641,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.
@@ -684,6 +687,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);